如何禁用甩在安卓图库 [英] how to disable fling in android gallery
问题描述
我在我的应用程序,并做一些测试中,我已经决定,我不希望画廊浏览用手指刷卡后的自定义库。我已经设置了一个按钮,左,右,而不是控制它。现在,我想弄清楚如何禁用 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??
感谢:)
推荐答案
一个更好的方法(如<一个href="http://stackoverflow.com/questions/4311854/how-can-i-limit-fling-in-android-gallery-to-just-one-item-per-fling">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;
}
这篇关于如何禁用甩在安卓图库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!