Android学习笔记10---View布局

来源:互联网 发布:三国乱世盘古辅助淘宝 编辑:程序博客网 时间:2024/06/08 07:56

用户界面之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.csdn.net/gemmem/article/details/7783525

我觉得把,ViewGroup就像是是一棵大树,大树上有单分支和多分支,单分支即View,多分支即ViewGroup。

后续有新功能尚在探索中...