安卓的布局
==================================
*相对布局 \nRelativeLayoutActivity
*)停靠父控件边界
alignParentTop
alignParentRight
alignParentBottom
alignParentLeft
*)相对父控件居中
centerInParent
centerHorizontal
centerVertical
*)停靠周围控件边界
above
below
toLeftof
toRightof
*)与周围控件边界对齐
alignTop
alignRight
alignLeft
alignBottom
alignBaseline
*线性布局 \nLinearLayoutActivity
--------------------------------------------------------
*)布局方向
orientation="horizontal" 水平(默认)
orientation="vertical" 垂直
*)比例、比重 按比例分配剩余可用控件
layout_weight="3"
layout_weight="2.5"
*)按比例来分配剩余可用空间
*)如果让控件大小严格按比例显示,可以把高度或者宽度设置为0dp
垂直布局中,height="0dp"
水平布局中,width="0dp"
*)重力引力
layout_gravity
top
bottom
right
left
center
center_horizontal
center_vertical
*表格布局 \nTableLayoutActivity
*)是LinearLayout的子类
是垂直线性布局
*)表格行
<TableRow>
是linearLayout,是水平线性布局
*)比例、比重
layout_weight
控制列的宽度
*)平均拉伸列
strechColumns="0,2"
strechColumns="1,3"
*帧布局 \nFrameLayoutActivity
-----------------------------------------
*)一般用来实现控件的层叠布局
*)重力引力
layout_gravity
可以组合为right|center_vertical
*)融合
<merge>
在窗口中,存在一个默认的帧布局
界面中的帧布局,放入窗口默认帧布局显示,会嵌套两层帧布局,将帧布局界面中的控件直接添加到默认帧布局中,减少一层布局嵌套。
*网格布局 \nGridLayoutActivity
--------------------------------------------------
安卓4.0之后才出现的
*)列的数量
columnCount="4"
*)设置控件放置的列
column="3"放置在第四列
column="1" 放置在第二列
*)跨行
rowSpan="2"
*)跨列
columnSpan="3"
*)重力引力拉宽
layout_gravity
fill
fill_horizontal
fill_vertical
*)空白控件
<space>