Android--布局方式(LinearLayout)学习
16lz
2021-01-23
线性布局是一个视图组,它所有的子视图都在一个方向对齐,水平或者垂直。
你可以指定布局的方向通过android:orientation 属性。、
Tips: 注意点:android中的LinearLayout使用时,当一行填满时候,不会自动换行,
多出的将不会被显示。
代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingLeft="16dip" android:paddingRight="16dip" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/to" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/subject" /> <EditText android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="top" android:hint="@string/message" /> <Button android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="right" android:text="@string/send" /></LinearLayout>截图如下:
更多相关文章
- 安卓布局文件中控件的各种属性的含义
- 日历视图的XML属性
- android排版(布局)
- android 屏幕方向切换 锁定方向
- android 布局特殊的属性介绍
- android 布局总结
- 自己归纳 Android 四种布局简介