0

This is my XML layout code

<?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:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent"
android:clipChildren="false" >
<RelativeLayout 
        android:id="@+id/ll" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:visibility="gone" 
        android:layout_below="@+id/handle"
        android:background="@android:color/black"
        android:layout_centerHorizontal="true"
        >
        <android.support.v4.view.ViewPager
            android:id="@+id/pager1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
             >


        </android.support.v4.view.ViewPager>
</RelativeLayout>
<ListView
    android:id="@+id/listF"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/handle"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:clipChildren="false" >

</ListView>
<RelativeLayout
        android:id="@+id/handle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:clipChildren="false"
        android:background="@drawable/bottom_glass_100_percent" >

        <ImageView
            android:id="@+id/handle1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentTop="true"
            android:scaleType="centerInside"
            android:background="@drawable/glass_globe"
            android:src="@drawable/icon_skull1" />

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="60dp"
            android:layout_alignParentLeft="true"
            android:background="@android:color/transparent"
            android:src="@drawable/leftselector" />

        <ImageButton
            android:id="@+id/imageButton2"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_centerVertical="true"
            android:layout_marginRight="60dp"
            android:layout_alignParentRight="true"
            android:background="@android:color/transparent"
            android:src="@drawable/rightselector" />

    </RelativeLayout>


</RelativeLayout>

i am translating layout ll to slide in and layout handle to slide out but when i am performing animation only handle layout translates and ll layout does not shows up. if i remove android:layout_below="@+id/handle" then it overlaps the handle layout and shows over it.

here is my translation xml

slide_in.xml

 <?xml version="1.0" encoding="utf-8"?>
 <translate 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:duration="@android:integer/config_longAnimTime" 
  android:fromYDelta="100%p" 
  android:toYDelta="18%p"
  android:fillEnabled="true"
  android:fillAfter="true"
  android:interpolator="@android:anim/accelerate_decelerate_interpolator">
  </translate>

Slide_out.xml

<?xml version="1.0" encoding="utf-8"?>
 <translate
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:duration="@android:integer/config_longAnimTime" 
  android:fromYDelta="0" 
  android:toYDelta="-82%p"
  android:fillEnabled="true"
  android:fillAfter="true"
  android:interpolator="@android:anim/accelerate_decelerate_interpolator"

  >
  </translate>

Only goes over to the handle layout when i use viewpager and when viewpager scrolling ends it resets to its original position.

Prem
  • 1
  • 3

1 Answers1

0

I think the problem might be because you are referenceing the RelativeLayout handle before you are using it AND you are using the @+id/ tag to reference it, which thereby adds it to your R file. Try taking out the + (i.e. @id/) and then defining the actual handle layout before the other two.

e.g.

<?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:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    android:clipChildren="false"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/handle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:background="@drawable/bottom_glass_100_percent"
        android:clipChildren="false" >

        <ImageView
            android:id="@+id/handle1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:background="@drawable/glass_globe"
            android:scaleType="centerInside"
            android:src="@drawable/icon_skull1" />

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="60dp"
            android:background="@android:color/transparent"
            android:src="@drawable/leftselector" />

        <ImageButton
            android:id="@+id/imageButton2"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="60dp"
            android:background="@android:color/transparent"
            android:src="@drawable/rightselector" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/ll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/handle"
        android:layout_centerHorizontal="true"
        android:background="@android:color/black"
        android:visibility="gone" >

        <android.support.v4.view.ViewPager
            android:id="@+id/pager1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </android.support.v4.view.ViewPager>
    </RelativeLayout>

    <ListView
        android:id="@+id/listF"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/handle"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:clipChildren="false" >
    </ListView>

</RelativeLayout>
paul
  • 1,193
  • 8
  • 11