Reputation: 761
How can i create the layout like i attached in the background as normal any layout.From that layout when i click any or get back to that layout, the overlay layout should come with any form fields buttons or text ...any
Thanks in advance.
Upvotes: 0
Views: 16576
Reputation: 544
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- other actual layout stuff here -->
</LinearLayout>
<LinearLayout
android:id="@+id/overlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right" >
</LinearLayout>
</FrameLayout>
Now any view you add under LinearLayout with android:id = "@+id/overlay"
will appear as overlay with gravity = right
hopefully this will help you
Upvotes: 0
Reputation: 25153
Use RelativeLayout or FrameLayout. The last child view will overlay everything else.
To be sure the overlay view is on top, you can call ViewGroup.bringChildViewToFront()
on the relative layout.
Example:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/root_view">
<EditText
android:layout_width="fill_parent"
android:id="@+id/editText1"
android:layout_height="fill_parent">
</EditText>
<EditText
android:layout_width="fill_parent"
android:id="@+id/editText2"
android:layout_height="fill_parent">
<requestFocus></requestFocus>
</EditText>
</FrameLayout>
In this layout, editText2 will cover the editText1
Upvotes: 4
Reputation: 3601
I believe you should use FrameLayout
, you can add objects one in front of the other. Please read about it at documentation.
Upvotes: 1