Android五大布局标签和属性总结

本文深入探讨了Android应用开发中的布局技术,包括LinearLayout、TabLayout、RelativeLayout等常见组件的使用方法,以及如何通过属性设置实现组件间的精确定位与对齐。同时介绍了不同布局组件的特点与应用场景,帮助开发者构建高效、美观的用户界面。
1.LinearLayout
orention  水平和垂直
weight     分割闲置空间
水平布局 分割宽度
垂直布局 分割的高度


分割的时候 指定的高度或者宽度不能用fill_parent/match_parent

2.Tablayout
<TabRow> </TabRow> 一行
<TabRow> </TabRow>
缺陷  第一行的列级关系 会影响下面所有的列
3.RelativeLayout
view间的关系
CenterInParent  true
alignparentxxxx true  有没有贴到父亲的位置
centerVertical  垂直剧中
centerHorzital  水平剧中

--------------------------------
aboveof    @view  再谁的上面
belowof    @view 在谁的下面
toleftof   @viw 在谁的左边

torightof @view 在谁的右边

alignxxxx @view 和谁在xxxx的边界上齐平


4.FrameLayout(层叠布局)
Fragment(碎片)
layout_gravity  相对于父容器
gravity 相对于自己
属性有top、bottom、left、right


5、AbsoluteLayout(绝对布局)
layout_x    某个view  x坐标
layout_y    某个view  y坐标

**********************************************************888



TextView 文字组件
text 显示的文字
textSize 文字大小
textColor 文字颜色
background 背景颜色


EditText 文本输入框
hint 提示文字


LinearLayout 线性布局
TableLayout 表格布局
RelativeLayout 相对布局


layout_width view宽度的方式
layout_height view高度的方式
match_parent 匹配父组件
wrap_content 包含内容


layout_weight 权重


orientation 布局方向
horizontal 水平
vertical 垂直


layout_margin 四周外边距
layout_marginTop 上边外边距
layout_marginBottom 下边外边距
layout_marginLeft 左边外边距
layout_marginRight 右边外边距


layout_padding 四周内边距
paddingTop 上边内边距
paddingBottom 下边内边距
paddingLeft 左边内边距
paddingRight 右边内边距

layout_above 在哪个view之上
layout_below 在哪个view之下
layout_toLeftOf 在哪个view之左
layout_toRightOf 在哪个view之右


layout_alignTop 和某个view的上边对齐
layout_alignBottom 和某个view的下边对齐
layout_alignLeft 和某个view的左边对齐
layout_alignRight 和某个view的右边对齐


layout_alignParentTop 是否紧贴父组件上边
layout_alignParentBottom 是否紧贴父组件下边
layout_alignParentLeft 是否紧贴父组件左边
layout_alignParentRight 是否紧贴父组件右边


layout_centerInParent 是否在父组件的中心
layout_centerHorizontal 是否水平居中
layout_centerVertical 是否垂直居中






TableRow 表格布局里面的一行
gravity 内容居中
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值