how to disable fling in android gallery

后端 未结 2 534
无人共我
无人共我 2020-12-20 04:19

I have a custom gallery in my app and after doing some testing I\'ve decided that I don\'t want the gallery to navigate with finger swipes. I\'ve set up a left and right bu

相关标签:
2条回答
  • 2020-12-20 04:53

    Oh, got it!

    In my custom gallery class:

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return false;
    
    }
    

    Figured that put from the gallery source code posted here: http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/Gallery.java.shtml

    :)

    0 讨论(0)
  • 2020-12-20 05:10

    A better approach (as described here) is to override the fling method in your custom gallery class:

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                           float velocityY) {        
        return false;
    }
    
    0 讨论(0)
提交回复
热议问题