Android LinearLayout 线性布局
示例
LinearLayout是一种ViewGroup将其子级排列在单列或单行中的。可以通过调用方法setOrientation()或使用xml属性来设置方向android:orientation。
垂直方向:android:orientation="vertical"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@android:string/cancel" />
</LinearLayout>这是一个屏幕截图,看起来像这样:
水平方向:android:orientation="horizontal"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@android:string/cancel"/>
该LinearLayout还支持分配权重,以个别儿童与android:layout_weight属性。
热门推荐
1 训练狗狗基础
2 怎么训练狗狗笑
3 怎么训练狗狗卧下
4 上海狗狗训练基地
5 训练狗狗排便
6 狗狗基础训练
8 如何训练狗狗装死
9 狗狗站姿训练
10 狗狗训练用品
11 训练狗狗吧
12 狗狗要怎么训练
13 怎么训练狗狗玩球
14 训练狗狗唤回
15 狗狗训练躺下
16 狗狗训练指令
17 狗狗的训练技巧
18 狗狗不好训练