Roger
Roger

Reputation: 6527

android, how to load linearlayout from another .xml file?

Say I have an .xml file with a menu that looks like this.

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/linearLayout1" android:orientation="vertical">
            <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2">
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView1" android:src="@drawable/menubtm0"></ImageView>
        </LinearLayout>
        <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout3">
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/menubtm1" android:id="@+id/btm_fav" android:clickable="true"></ImageView>
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/menubtm2" android:id="@+id/btm_search" android:clickable="true"></ImageView>
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/menubtm3" android:id="@+id/btm_browse" android:clickable="true"></ImageView>
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/menubtm4" android:id="@+id/btm_settings" android:clickable="true"></ImageView>
        </LinearLayout>
    </LinearLayout>

What would be the best way to load it into another xml file? For example into some FormLayout or something?

Thanks!

Upvotes: 1

Views: 761

Answers (1)

whlk
whlk

Reputation: 15635

You are probably looking for the Include tag.

Upvotes: 3

Related Questions