用户界面之View布局
来一段比较直观的代码
<!-- 线程布局:
orientation="horizontal" 线性布局的排列方式是水平的
orientation="vertical" 线性布局的排列方式是垂直的
gravity="center" 控制当前控件内容显示区域
visibility="visible" 显示
visibility="invisible" 不显示
visibility="gone" 控制布局不显示,但占控件
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weigth="1"
android:orientation="horizontal"
android:gravity="center"
android:visibility="visible">
</LinearLayout>
<!-- 相对布局:相对于某个控件的位置
android:layout_toRightOf 在指定控件的右边
android:layout_toLeftOf 在指定控件的左边
android:layout_above 在指定控件的上边
android:layout_below 在指定控件的下边
android:layout_alignBaseline 跟指定控件水平对齐
android:layout_alignLeft 跟指定控件左对齐
android:layout_alignRight 跟指定控件右对齐
android:layout_alignTop 跟指定控件顶部对齐
android:layout_alignBottom 跟指定控件底部对齐
android:layout_alignParentLeft 是否跟父布局左对齐
android:layout_alignParentTop 是否跟父布局顶部对齐
android:layout_alignParentRight 是否跟父布局右对齐
android:layout_alignParentBottom 是否跟父布局底部对齐
android:layout_centerVertical 在父布局中垂直居中
android:layout_centerHorizontal 在父布局中水平居中
android:layout_centerInParent 在父布局中居中
-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</RelativeLayout>
<!-- 绝对布局: 都不用了-->
<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</AbsoluteLayout>
<!-- 表格布局
shrinkColumns="" 收缩列
stretchColumns="" 拉伸列
collapseColumns="" 隐藏列
-->
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shrinkColumns=""
android:stretchColumns=""
android:collapseColumns="">
</TableLayout>
<!-- 桢布局 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
what is View&ViewGroup in Android?
http://blog.youkuaiyun.com/gemmem/article/details/7783525
我觉得把,ViewGroup就像是是一棵大树,大树上有单分支和多分支,单分支即View,多分支即ViewGroup。
后续有新功能尚在探索中...