设置为dispatchTouchEvent列表视图,而无需创建自定义列表视图类。 (禁用滚动) [英] Set dispatchTouchEvent for List View without creating custom List View class. (for disabling scroll)
本文介绍了设置为dispatchTouchEvent列表视图,而无需创建自定义列表视图类。 (禁用滚动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,我试图禁用列表视图滚动。它可以这样做。
I'm basically trying to disable the scroll on List View. Which can be done by
@Override
public boolean dispatchTouchEvent(MotionEvent ev){
if(ev.getAction()==MotionEvent.ACTION_MOVE){
ev.setAction(MotionEvent.ACTION_CANCEL);
}
super.dispatchTouchEvent(ev);
return true;
}
但是我不希望创建一个自定义列表视图(小部件)类此。
有什么办法,我可以做到像 myListView.dispatchTouchEvent(EV)
???
Is there any way I could do it like myListView.dispatchTouchEvent(ev)
???
先谢谢了。
推荐答案
试试这个:
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return true;
}
这篇关于设置为dispatchTouchEvent列表视图,而无需创建自定义列表视图类。 (禁用滚动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文