I am working on an application which is like a menu and my relative layout for the menu with options is covered by another relative layout that contains an image. Could you guys tell me where am I going wrong? Realistically, I would want the menu to be at the top with options in the middle and the image to be at the bottom.
Here’s my xml code:
<RelativeLayout
android:id="@+id/RelativeLayout02"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android >
<ImageView
android:id="@+id/imageView3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="false"
android:contentDescription="@string/desc"
android:scaleType="fitEnd"
android:src="@drawable/half" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="match_parent"
android:layout_height="247dp" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/desc"
android:src="@drawable/paranoid_android" />
<TextView
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:text="@string/menu"
android:textColor="@color/white"
android:textSize="@dimen/titlefont" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/desc"
android:src="@drawable/paranoid_android" />
</RelativeLayout>
Thanks.
Just put it all in one relative layout – that’s what relative layouts are for. Add the image before or after the rest of the components to have it below or above them. Relative layouts are designed such that moving one view around in them has no effect on the positioning of other views in the layout, so you can layer views on top of each other.