如何禁用甩在安卓图库图库

由网友(看淡一切╮)分享简介:我在我的应用程序,并做一些测试中,我已经决定,我不希望画廊浏览用手指刷卡后的自定义库。我已经设置了一个按钮,左,右,而不是控制它。现在,我想弄清楚如何禁用 onFling 方法。我试过 this.setEnabled(假); 没有工作,并试图 this.setClickable(假); ,没有工作......也是我重写...

我在我的应用程序,并做一些测试中,我已经决定,我不希望画廊浏览用手指刷卡后的自定义库。我已经设置了一个按钮,左,右,而不是控制它。现在,我想弄清楚如何禁用 onFling 方法。我试过 this.setEnabled(假); 没有工作,并试图 this.setClickable(假); ,没有工作......也是我重写 onFling()方法以外的所有回报(真正的);注释掉....不知道什么尝试!任何想法??

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 button to control it instead. Now I want to figure out how to disable the onFling method. I've tried this.setEnabled(false); which didn't work, and tried this.setClickable(false); which didn't work... also my overridden onFling() method has everything except the return(true); commented out.... not sure what else to try! Any ideas??

感谢:)

推荐答案

一个更好的方法(如here)是覆盖一扔方法在自定义库类:

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;
}
阅读全文

相关推荐

最新文章