FrameLayout is one of the useful layout provided by android system, which allows User Interface widgets to be overlapped with each other.Simply , Frame Layout should be used to hold a single child view, because it can be difficult to organize child views in a way that’s salable to different screen sizes without the children overlapping each other.
webhead-Frame2

FrameLayout Example:-

<pre><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="20dp"
    android:background="#000000">
   <FrameLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:padding="20dp"
       android:background="@android:color/holo_red_dark">
      <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:padding="20dp"
          android:orientation="vertical"
          android:background="@android:color/holo_purple">

          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:padding="20dp"
              android:background="@android:color/holo_green_light">

          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/holo_blue_light"/>
      </LinearLayout>

</LinearLayout>
   </FrameLayout>
    </LinearLayout></pre>

Result:-
Frame_layout

Advertisements