1.在一个程序中使用多种布局管理器排版。
<?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:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<LinearLayout //内置线性布局管理器
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mldn_3g" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mldn_man" />
</LinearLayout>
<TableLayout //内置表格布局管理器
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableRow>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入检索关键字" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="检索" />
</TableRow>
</TableLayout>
</LinearLayout>
05 布局管理器的嵌套
最新推荐文章于 2023-09-06 14:50:10 发布