dispatchTouchEvent在片段中的Android [英] dispatchTouchEvent in Fragment in Android
本文介绍了dispatchTouchEvent在片段中的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让刷卡和向下滑动手势片段工作。
同样是从事活动的罚款。在片段我有dispatchTouchEvent的问题。我怎么你片段dispatchTouchEvent?是否有一个等效的方式做到这一点?
@覆盖
公共布尔dispatchTouchEvent(MotionEvent我)
{
this.detector.onTouchEvent(箱);
返回super.dispatchTouchEvent(箱);
}
解决方案
如果你的目标是检测/手柄轻扫,创建视图后的片段的视图中添加触摸事件侦听器。
I am trying to get Swipe up and swipe down gestures working on Fragment. The same is working fine on activity. On Fragment I have an issue with dispatchTouchEvent. How do I you dispatchTouchEvent in Fragment? Is there an equivalent way achieve this?
@Override
public boolean dispatchTouchEvent(MotionEvent me)
{
this.detector.onTouchEvent(me);
return super.dispatchTouchEvent(me);
}
解决方案
If your goal is to detect/handle swipe, add touch event listener on the fragment's view after creating the view.
这篇关于dispatchTouchEvent在片段中的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文