0
我有一个ViewPager和一个SectionPagerAdapter处理Fragments。调度GestureEvent(TouchEvent)在Viewpager中查看
片段具有以下布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/tvemptyview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/card_bg"
android:text="@string/no_trans"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ListView
android:id="@+id/transactionlist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:divider="@null"
android:dividerHeight="0dp" >
</ListView>
<RelativeLayout
android:id="@+id/rLayout1"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@drawable/footer_shadow"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/btn_dateback"
android:text="test"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</RelativeLayout>
我想在TextView的tvMonth
赶上滑动手势(左或右),但我完全不知道如何从ViewPager调度事件直到TextView本身。片段只是继续滚动,就是这样。
我可以附加一个OnTouchListener到TextView和识别工作相当好,但标签正在改变。
我该如何解决这个问题?
您可以尝试编写viewpager的自定义实现。检查这个问题并回答更多信息。 http://stackoverflow.com/questions/16342630/how-to-disable-viewpager-adapter-on-touching-specific-views –