1

I'm trying to use the SlidingUpPanel from umano and have the slider be a ViewPager.

However, when trying to scroll left and right the ViewPager isn't moving. It appears the touch events are being intercepted by the 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>
Jay S.
  • 441
  • 1
  • 6
  • 18

1 Answers1

5

Try:

  • Use the setDragView method for the ViewPager.
  • Use the setEnableDragViewTouchEvents so the dragview/ViewPager can have it's own touch events.

Alternatively make a seperate View apart from the ViewPager that is intended to be for dragging and set the DragView to this View accordingly, the ViewPAger should receive the touch events seperately and can handle them. (the latter is how I do it and works with other layout)

  • That way would work, but it requires having a 'drag handle' like functionality and the ViewPager would only support swiping left and right. I would still like to find a solution which allows the ViewPager to be dragged vertically. – Jay S. Feb 19 '14 at 22:25
  • I've tried this with no results. Did you mean: slidingUpPanelLayout.setDragView(((MainActivity)getActivity()).viewPager); slidingUpPanelLayout.setEnableDragViewTouchEvents(true); – Giorgio Jul 13 '14 at 19:16