Android(安卓)ApiDemos示例解析(141):Views->Layouts->LinearLayout->1. Vertical
LinearLayout 将其子View顺序排成一行或是一列,一个垂直列表每行将只有一个子元素(无论它们有多宽),一个水平列表只是一列的高度(最高子元素的高度来填充)。
本例介绍了LinearLayout 的基本用法,LinearLayout的方向可以使用android:orientation 来定义,可以指定vertical 或是 horizontal ,缺省为横向horizontal。
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:background=”@drawable/blue”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>
<!– view1 goes on top –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_top”/>
<!– view2 goes in the middle –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_middle”/>
<!– view3 goes on the bottom –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_bottom”/>
</LinearLayout>
Layouts->LinearLayout->1. Vertical_第1张图片" src="https://img.it610.com/image/info5/812e02b8c7b046358473776ffd39c772.jpg" width="331" height="491" style="border:1px solid black;">
更多相关文章
- Android(安卓)用 ListView 实现倒计时列表功能
- Android布局方式(AbsoluteLayout)学习
- Android之Weight属性源码解析
- 安卓布局之线性布局(Linearlayout)
- Android流式布局FlowLayout
- 记录-解决设置透明状态栏,软键盘弹起问题
- Andriod 实现可拖动列表
- 对话框大合集
- Android(安卓)ListView的每个子Item如何设置高度