How to combine a performance with another?

I would like to display a ViewPager that should fill the entire screen on top of another view by hiding it. This second view should be set to the bottom of the screen and should be displayed when the user resets from bottom to top on the ViewPager; it should perform an animation that moves the ViewPager up until the second view is displayed.

The thing is, I cannot traverse the second view, it is always shown and never hidden by the ViewPager. No matter what order I use to customize my layout in xml (declare ViewPager first and then second view or reverse) or how I use RelativeLayout or FrameLayout.

Here is the code I'm using:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/hlist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:background="@drawable/bg_shelf"
        android:orientation="horizontal" >
    </LinearLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

</RelativeLayout>

      

+3


source to share


1 answer


I followed the following post: Overlapping Views in Android and I was able to match my view with the following xml config:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/hlist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_gravity="center_vertical"
        android:background="@drawable/bg_shelf"
        android:orientation="horizontal" >
    </LinearLayout>


    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignBottom="@id/hlist"
        android:layout_alignLeft="@id/hlist"
        android:layout_alignRight="@id/hlist"/>

</RelativeLayout>

      

+2


source







All Articles