如何允许单多点触控 [英] How to allow single multitouch
本文介绍了如何允许单多点触控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写一个定制的ViewGroup,我只需要使用一根手指的触摸,想要彻底清除多点触控。我曾与其他选项被选中的android:splitMotionEvents =FALSE
的android:windowEnableSplitTouch =FALSE
但都没有工作。
I am writing an custom ViewGroup where I need to use only single finger touch and wanted to remove multitouch completely. I have checked with other option android:splitMotionEvents="false"
android:windowEnableSplitTouch="false"
but both are not working.
修改
@Override
public boolean onTouchEvent(MotionEvent ev) {
DragHelper.processTouchEvent(ev);
return true;
}
任何建议!
推荐答案
尝试以下把定制的视图code。
Try following code in your custom view.
@Override
public boolean onTouchEvent(MotionEvent event)
{
// TODO Auto-generated method stub
if(event.getPointerCount() > 1) {
System.out.println("Multitouch detected!");
return true;
}
else
{
return super.onTouchEvent(event);
}
}
这篇关于如何允许单多点触控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文