android - Linear Layout inside Frame Layout stops working -


my layout working fine, has parent linear layout , multiple linear layouts inside it.

now need add background image,so need add frame layout here.

when change parent linear layout frame layout, disappears items in linear layout.

if add frame layout,inside linear layout disappears items in linear layout.

i unable understand how put frame layout without removing linear layout items.

the layout code quite long.

i putting above part of it.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent"     >       <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="6"         android:orientation="vertical"         >          <linearlayout             android:layout_width="match_parent"             android:layout_height="80dp"             android:orientation="horizontal"             android:layout_margintop="20dp"             android:layout_marginleft="30dp"             android:layout_marginright="30dp"             >              <imageview                 android:layout_width="0dp"                 android:layout_height="wrap_content"                 android:layout_weight="0.8"                 android:src="@drawable/image11"                 />              <linearlayout                 android:layout_width="0dp"                 android:layout_height="wrap_content"                 android:layout_weight="1"                 android:orientation="vertical"                 android:paddingtop="10dp"                  >              <textview                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:text="7:00 pm cst"                 android:layout_gravity="center"                 android:gravity="center"                 android:textcolor="@color/white"                 android:fontfamily="sans-serif-medium"                 android:textsize="12sp"                 />          </linearlayout>          <imageview             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="0.8"             android:src="@drawable/icon2"             />      </linearlayout>          <linearlayout         android:layout_width="match_parent"         android:layout_height="40dp"         android:orientation="horizontal"         android:paddingleft="20dp"         android:paddingright="20dp"         >           <linearlayout             android:layout_width="0dp"             android:layout_height="match_parent"             android:layout_weight="4"             android:orientation="vertical"             android:background="@drawable/cart_custom_background"             android:paddingbottom="2dp"             >              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:layout_weight="4"                 android:orientation="horizontal"                 android:layout_marginright="1dp"                 android:layout_marginleft="1dp"                 > 

now need add background image,so need add frame layout here.

you don't need add layout give background. root (or other)<linearlayout> should enough. can set background using:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/my_drawable" > // can give color here 

when change parent linear layout frame layout, disappears items in linear layout.

thats because <framelayout> unlike <linearlayout> kept adding children on top of each other.


Comments