LinearLayout 线性布局
LinearLayout是Android布局的常用布局,它的子控件是按照横向或纵向依次排列的,如果控件排列超出线性布局的范围则不显示超出范围的控件。
代码实例
<LinearLayout
android:layout_width="match_parent" //设置LinearLayout宽度
android:layout_height="match_parent" //设置LinearLayout高度
android:orientation="vertical" //设置LinearLayout排列 横向(horizontal)纵向(vertical)
>
<TextView
android:layout_width="wrap_content" //设置子控件的宽度
android:Layout_height="wrap_content" //设置子控件的高度
android:layout_weight="1" //设置权重比例
/>
<LinearLayout/>
宽度和高度参数介绍 : 其中参数 wrap_content 是按照控件内容的合适大小进行设置 ,参数 match_parent 是父控件剩余的 所有的宽和高.
LinearLayout权重 是父控件剩余空间的所占比例