I'm looking for a way to inflate another layout into the first layout in android. How would one do this? Here are the two XML files. The first is the main layout, the second is the layout I would like to inflate into the first.
I can't just include the layout as I will use this method to inflate other layouts into wire frames later on.
Code also at: http://pastebin.com/wjZ4s1cs as stackoverflow does not like XML.
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff000000"
>
<TextView
android:id="@+id/headerMenuText"
android:text="@string/main_menu_title"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textSize="16pt"
android:paddingTop="10px"
android:paddingBottom="10px"
android:gravity="center"
>
</TextView>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_y="100dip"
android:gravity="center"
android:layout_gravity="center"
>
<TableRow
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:id="@+id/menuItem1"
android:layout_height="101dip"
android:layout_width="89dip"
android:src="@drawable/icon_settings"
></ImageView>
<ImageView
android:id="@+id/menuItem2"
android:layout_height="101dip"
android:layout_width="89dip"
android:src="@drawable/icon_system_restart"
></ImageView>
<ImageView
android:id="@+id/menuItem3"
android:layout_height="101dip"
android:layout_width="89dip"
android:src="@drawable/icon_game_history"
></ImageView>
<ImageView
android:id="@+id/menuItem4"
android:layout_height="101dip"
android:layout_width="89dip"
android:src="@drawable/icon_game_correction"
></ImageView>
<ImageView
android:id="@+id/menuItem5"
android:layout_height="101dip"
android:layout_width="89dip"
android:src="@drawable/icon_game_other"
></ImageView>
</TableRow>
<TableRow android:gravity="center">
<TextView
android:id="@+id/menuItemText1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/main_menu_item_text_1"
android:layout_gravity="center"
android:gravity="center"
></TextView>
<TextView
android:id="@+id/menuItemText2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/main_menu_item_text_2"
android:layout_gravity="center"
android:gravity="center"
></TextView>
<TextView
android:id="@+id/menuItemText3"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/main_menu_item_text_3"
android:layout_gravity="center"
android:gravity="center"
></TextView>
<TextView
android:id="@+id/menuItemText4"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/main_menu_item_text_4"
android:layout_gravity="center"
android:gravity="center"
></TextView>
<TextView
android:id="@+id/menuItemText5"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/main_menu_item_text_5"
android:layout_gravity="center"
android:gravity="center"
></TextView>
</TableRow>
</TableLayout>
<View or layout
android:id="@+id/screen_layout_bottom_menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</View or layout>
</AbsoluteLayout>
Second layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen_bottom_menu"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
<TableLayout
android:id="@+id/screen_bottom_menu_table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
<TableRow>
<ImageView
android:id="@+id/screen_bottom_menu_button_back"
android:src="@drawable/back">
</ImageView>
<ImageView
android:id="@+id/screen_bottom_menu_button_ok"
android:src="@drawable/checkmark">
</ImageView>
<ImageView
android:id="@+id/screen_bottom_menu_button_cancel"
android:src="@drawable/xmark">
</ImageView>
<ImageView
android:id="@+id/screen_bottom_menu_button_key_toggle"
android:src="@drawable/lock">
</ImageView>
</TableRow>
</TableLayout>
</LinearLayout>