文章目录
基本属性
gravity:
ignoreGravity:
根据父容器定位
layout_alignParentLeft:
layout_alignParentRight:
layout_alignParentTop:
layout_alignParentBottom
layout_centerHorizontal:
layout_centerVertical:
layout_centerInParent:
根据兄弟组件定位
layout_toLeftOf:
layout_toRightOf:
layout_above:
layout_below:
layout_alignTop:
layout_alignBottom:
layout_alignLeft:
layout_alignRight:
margin(偏移):
layout_margin:
layout_marginLeft:
layout_marginRight:
layout_marginTop:
layout_marginBottom:
padding(填充):
layout_padding:
layout_paddingLeft:
layout_paddingRight:
layout_paddingTop:
layout_paddingBottom:
基本属性
gravity:
设置容器中组件的对齐方式。
ignoreGravity:
设置了该属性为true的组件,将不受gravity属性影响。
根据父容器定位
layout_alignParentLeft:
左对齐
layout_alignParentRight:
右对齐
layout_alignParentTop:
顶部对齐
layout_alignParentBottom
底部对齐
layout_centerHorizontal:
水平居中
layout_centerVertical:
垂直居中
layout_centerInParent:
中央位置
根据兄弟组件定位
layout_toLeftOf:
参考组件的左边
layout_toRightOf:
参考组件的右边
layout_above:
参考组件的上方
layout_below:
参考组件的下方
layout_alignTop:
对齐参考组件的上边界
layout_alignBottom:
对齐参考组件的下边界
layout_alignLeft:
对齐参考组件的左边界
layout_alignRight:
对齐参考组件的右边界
margin(偏移):
设置组件与父容器的边距,又叫偏移。(margin的参数可以设置为负数)
layout_margin:
设置组件上下左右的偏移量
layout_marginLeft:
设置组件距离父容器左边界的偏移量
layout_marginRight:
设置组件距离父容器右边界的偏移量
layout_marginTop:
设置组件距离父容器上边界的偏移量
layout_marginBottom:
设置组件距离父容器下边界的偏移量
padding(填充):
设置组件内部元素间与组件边界两者间的填充距离
layout_padding:
往内部元素的上下左右各填充一定距离
layout_paddingLeft:
往内部元素的左边填充一定距离
layout_paddingRight:
往内部元素的右边填充一定距离
layout_paddingTop:
往内部元素的上边填充一定距离
layout_paddingBottom:
往内部元素的下边填充一定距离