Android - Combining Multiple Layouts in a Layout
COMBINING LAYOUTS IN A LAYOUT
The main.xml file is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Layout 1" />
<include android:id="@+id/cell1" layout="@layout/layout1" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Layout 2" />
<include android:id="@+id/cell2" layout="@layout/layout2" />
</LinearLayout>The layout1.xml file is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff0000" >
<TextView android:layout_width="fill_parent"
android:layout_height="40px"
android:text="TextView" />
<EditText android:layout_width="250px"
android:layout_height="wrap_content"
android:hint="EditText" /><CheckBox android:layout_width="fill_parent"
android:layout_height="40px"
android:text="Checkbox" />
</LinearLayout>The layout2.xml file is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00ff00" >
<TextView android:layout_width="fill_parent"
android:layout_height="40px"
android:text="TextView" />
<EditText android:layout_width="250px"
android:layout_height="wrap_content"
android:hint="EditText" /><CheckBox android:layout_width="fill_parent"
android:layout_height="40px"
android:text="Checkbox" />
</LinearLayout>The OUTPUT will be
No comments:
Post a Comment