Home > Tricks & Tips > Disable vertical scrolling of GridView

Disable vertical scrolling of GridView

Working on an application, and find a way to disable the annoying vertical scrolling on GridView when users touch and move finger upward. This is the trick I’d like to share you all.

gridview.setOnTouchListener(new OnTouchListener(){

    public boolean onTouch(View v, MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_MOVE){
            return true;
        return false;


Interesting, isn’t it?
As you can see, this will handle the ACTION_MOVE, well, no need to care about it anymore. Have fun!

Pete Houston

  1. satish kumar
    October 9, 2012 at 4:32 pm

    nice code great

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: