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

用户界面之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。

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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值