I’ve been stuck on this for a while so I thought I would ask. Previously I had an ImageView with buttons underneath. But I would like to have the buttons on top, and the ImageView underneath the buttons, but can’t figure out how to do it. Here is the XML I have at the moment. Does anyone know what is wrong?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/Button_ILLNESS"
android:layout_width="wrap_content"
android:layout_height="@dimen/menu_button_height"
android:layout_alignTop="@+id/Button_ILLNESS"
android:text="@string/illness"
android:textSize="@dimen/menu_button_text_size" >
</Button>
<Button
android:id="@+id/Button_SYMPTOM"
android:layout_width="wrap_content"
android:layout_height="@dimen/menu_button_height"
android:layout_toRightOf="@+id/Button_ILLNESS"
android:text="@string/symptom"
android:textSize="@dimen/menu_button_text_size" >
</Button>
<Button
android:id="@+id/Button_REMEDY"
android:layout_width="wrap_content"
android:layout_height="@dimen/menu_button_height"
android:layout_toRightOf="@+id/Button_SYMPTOM"
android:text="@string/remedy"
android:textSize="@dimen/menu_button_text_size" >
</Button>
<Button
android:id="@+id/Button_HELP"
android:layout_width="wrap_content"
android:layout_height="@dimen/menu_button_height"
android:layout_toRightOf="@+id/Button_REMEDY"
android:text="@string/help"
android:textSize="@dimen/menu_button_text_size" >
</Button>
<Button
android:id="@+id/Button_INFO"
android:layout_width="wrap_content"
android:layout_height="@dimen/menu_button_height"
android:layout_toRightOf="@+id/Button_HELP"
android:text="@string/info"
android:textSize="@dimen/menu_button_text_size" >
</Button>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</RelativeLayout>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ImageView_MenuHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:src="@drawable/splash_android_650x480" >
</ImageView>
</LinearLayout>
This would give you buttons on top:
However, i would suggest using nested
LinearLayout‘s, internal – horisontal for buttons and vertical for layout with buttons and image.