0
在相對佈局中有一個viewpager和RelativeLayout。ViewPager在其上有視圖時無法響應觸摸事件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:weather="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainview_id">
<android.support.v4.view.ViewPager
android:id="@+id/main_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<PushPullDoorView
android:id="@+id/pull_down_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</PushPullDoorView>
的PushPullDoorView已經覆蓋的onTouchEvent method.it可以被拖累而up.But當我嘗試移動viewpager,它不會響應event.I嘗試覆蓋dispatchTouchEvent ,onInterceptTouchEvent,並設置返回值爲true或false.It仍然不起作用。
PushPullDoorView具有透明背景。我們可以看到視圖內容。所以我想在被覆蓋的時候移動vewpager。任何想法? – shaotine
我發現了我在onTouchEvent方法中返回true的原因。刪除它,它完美地工作。 – shaotine