My program had two layout: layout1 and layout2.
I make the layout2 visible while layout1 is touched by OnTouchListener().
I want layout2 on the top of layot1.
On the contrary, layout2 is overridden by layout1.
Any one can help me to resolve the problem?
My code as:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="invisible">
<ImageButton
android:id="@+id/video_playback_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"/>
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true" android:layout_below="@id/relativeLayout2"/>
</RelativeLayout>
I want relativeLayout2 to override videoView1.
Try FrameLayout using which you can make stack of Views.Also have a look at ViewFlipper.Also if you can place your layouts as fragments that also provide way to do this, depending on your requirements you can choose the best.