查看传呼机onInterceptTouchEvent不产生事件 [英] View pager onInterceptTouchEvent not generating event
本文介绍了查看传呼机onInterceptTouchEvent不产生事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经写了一个自定义的 ViewPager ,但它不是产生连续Action.Move事件。在触摸它产生下一次,将事件的2-3倍,这就是它。然后后不产生移动事件。
I have written an custom ViewPager but it's not generating event for Continuous Action.Move. On touch it generate DOWN once and MOVE event 2-3 time and that's it. Then after it not generate MOVE event.
父XML code。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<example.animation.com.CustomPager
android:id="@+id/pager"
android:background="#123456"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
添加的子片段XML实现:
Added Child Fragment XML implementation:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fmParent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtIndex" />
</FrameLayout>
任何建议,如果我在这里缺少什么。
Any suggestion if I am missing anything here.
推荐答案
也许有些观点赶上事件,因此,如果只是ViewPager应该抓住倒是可以改变ViewPagerfrom返回:
Probably some view catch the event, so if just the ViewPager should catch the touches you can change the return of the ViewPagerfrom:
return super.onInterceptTouchEvent(ev);
到
return true;
这篇关于查看传呼机onInterceptTouchEvent不产生事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文