I have a view behind a ViewPager
. This view slides up and down vertically, using an OnTouchListener
. This works fine when part of the view is shown, but I'd like to make it so users can swipe downward from the top of the ViewPager
to reveal this view. I've tried subclassing ViewPager
and returning false in onInterceptTouchEvent
, but it did not work. I've also tried adding this OnTouchListener
to the ViewPager
itself as a hack but this didn't work either.
The images below represent what I'm trying to achieve.
Collapsed View behind ViewPager
Swiping View from behind the ViewPager
This is the simple layout code I've been testing with:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/content"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="128dp" />
</RelativeLayout>