How to show two layout together in activity?

146 Views Asked by At

Split page in Android, I need to slide the second page on top of another.

Layout 1 covering 80% of the page to the left. Layout 2 showing on the rest of the 20%. to the right.

Then I need to drag/slide layout 2 on top of layout 1 and the slide it back.

I have tried this, but I don't know how to configure this for my requirement?

What I Really need is shown in below as screenshots

OnLoad

enter image description here

After Slide

enter image description here

Slide Back

enter image description here

2

There are 2 best solutions below

3
On

I think you need SlidingPaneLayout, like google Hangouts app. It works what you want. Documentation here http://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.html

3
On

You can like this. try

<FrameLayout
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:background="#D6FFD6"
          xmlns:android="http://schemas.android.com/apk/res/android">
         <ImageView
                     android:src="@drawable/android"
                     android:scaleType="fitCenter"
                     android:layout_height="fill_parent"
                     android:layout_width="fill_parent"/>
         <TextView
                      android:text="learnandroideasily.blogspot.com"
                      android:textSize="30sp"
                      android:textStyle="bold"
                      android:textColor="#003399"
                      android:layout_height="fill_parent"
                      android:layout_width="fill_parent"
                      android:gravity="center"/>
</FrameLayout>

Also you can follow 3 tutorial site. where easily explain frame layout of android. such as

number #1 Frame Layout In Android

number #2 Android User Interface Design: Frame Layouts

and finally number #3 Android Frame Layout