1
我试图使用umano中的SlidingUpPanel,并将滑块设置为ViewPager。与SlidingUpPanel中的ViewPager交互
但是,当试图向左和向右滚动ViewPager不移动。看起来触摸事件被SlidingUpPanel拦截。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slider_layout"
android:layout_gravity="bottom">
<!-- Top Panel -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
<!-- Sliding Panel -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pager">
</android.support.v4.view.ViewPager>
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
这种方式可行,但它需要具有类似功能的“拖动手柄”,并且ViewPager仅支持左右滑动。我仍然希望找到一个解决方案,允许ViewPager垂直拖动。 –
我试过这个没有结果。您的意思是: slidingUpPanelLayout.setDragView(((MainActivity)getActivity())。viewPager); slidingUpPanelLayout.setEnableDragViewTouchEvents(true); – Giorgio