LinearLayout(线性布局)


1.weight属性详解:

用法归纳: 

    按比例划分水平方向:将涉及到的View的android:width属性设置为0dp,然后设置为android weight属性设置比例即可;

    类推,竖直方向,只需设android:height为0dp,然后设weight属性即可!

    如果我们不适用上述那种设置为0dp的方式,直接用wrap_content和match_parent的话, 则要接着解析weight属性了,分为两种情况,wrap_content与match_parent!

    另外还要看 LinearLayout的orientation是水平还是竖直,这个决定哪个方向等比例划分

        wrap_content比较简单,直接就按比例就可以.

        match_parent(fill_parent):则需要计算.

posted @ 2016-03-23 13:31  xmjz  阅读(133)  评论(0编辑  收藏  举报