Android自学笔记之 Android五大布局之线性布局的功能、常用属性、用法
来源:互联网 发布:淘宝客 运营 合作协议 编辑:程序博客网 时间:2024/06/08 18:43
1.介绍:
android:orientation = “vertical” —— 该属性决定它子类控件的排布方式(vertical:垂直;horizontal:水平)
android:gravity = “center” —— 该属性决定它子类控件的xy的位置
常用属性值
center_vertical:垂直(Y轴)居中
center_horizontal:水平(X轴)居中
center:垂直水平都居中
right/left/buttom:子类控件位于当前布局的右/左/下面
android:layout_gravity----当前控件本身和父控件的位置
android:gravity --- 当前控件的子控件在父控件的位置
!布局里是可以套用布局的
gravity属性:决定它子类的xy位置
线性布局管理器对存放其中的控件或布局采用线性方式管理
2.LinearLayout的常用属性android:orientation = “vertical” —— 该属性决定它子类控件的排布方式(vertical:垂直;horizontal:水平)
android:gravity = “center” —— 该属性决定它子类控件的xy的位置
常用属性值
center_vertical:垂直(Y轴)居中
center_horizontal:水平(X轴)居中
center:垂直水平都居中
right/left/buttom:子类控件位于当前布局的右/左/下面
android:layout_gravity----当前控件本身和父控件的位置
android:gravity --- 当前控件的子控件在父控件的位置
!布局里是可以套用布局的
gravity属性:决定它子类的xy位置
gravity属性可以多个连用,用|隔开
3.用法
<span style="font-family:KaiTi_GB2312;"><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="第一个Button按钮" android:id="@+id/button_first" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="第二个Button按钮" android:id="@+id/button2" android:layout_gravity="center_horizontal" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="实现跳转页面功能" android:id="@+id/textView" android:layout_gravity="center_horizontal" /></LinearLayout></span>
0 0
- Android自学笔记之 Android五大布局之线性布局的功能、常用属性、用法
- Android自学笔记之 LinearLayout线性布局
- Android 五大布局之线性布局和相对布局
- android五大布局之LinearLayout(线性布局)
- android 五大布局之LinearLayout(线性布局)
- Android学习-五布局之线性布局
- 自学Android系列 笔记2 Android 学习之浅谈Android五大布局
- Android学习笔记之五大布局
- Android 学习笔记之五大布局
- Android之五大布局
- Android之五大布局
- Android五大布局之相对布局
- Android五大布局之网格布局
- Android常用五大布局属性控制
- Android 五大布局之(一) 线性布局和相对布局
- android布局之线性布局
- android布局之线性布局
- Android布局之线性布局
- Looking for an example for inserting content into the response using a servlet filter
- [LeetCode]Pow(x,n)
- 随笔
- Android自学笔记之Spinner下拉框的功能、使用
- 第三章线程同步辅助类
- Android自学笔记之 Android五大布局之线性布局的功能、常用属性、用法
- Android自学笔记之Intent 页面跳转详解
- [Windows通用应用开发] 代码编写StoryBoard时可能遇到的几个问题
- C语言的国际化
- [Unity5.1]同步动画UNET
- android Matrix.setRotate 和 postRotate的区别
- matrix设置原始位置
- [android]service中再启service
- 项目开发流程