线性布局:LinerLayout 也是最简单的布局,有水平和竖直两种方式。可以通过参数来控制控件在布局中的相对大小。
<LinearLayout
android:layout_width="fill_parent" 填充父控件
android:layout_height="wrap_content" 控件高度包裹内容
android:orientation="vertical" > 垂直排列
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/LinearLayout" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/LinearLayout" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent" 填充父控件
android:layout_height="wrap_content" 控件高度包裹内容
android:orientation="vertical" > 垂直排列
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/LinearLayout" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/LinearLayout" />
</LinearLayout>
本文详细介绍了LinearLayout布局在Android开发中的使用方法,包括如何设置其宽度、高度及方向,以及通过参数控制子控件的相对大小。通过实例演示了垂直排列文本视图的应用。
742

被折叠的 条评论
为什么被折叠?



