Android learning - 008 Common Layout


Android learning - 008 Common Layout

  • 线性布局 LinearLayout
  • 相对布局 RelativeLayout
  • 帧布局 FrameLayout

补充两个通用属性

  • Margin
  • padding

线性布局LinearLayout

特有属性:

  • 方向 orientation :子view的排列方向(垂直 vertical 或者 水平 horizontal )

字view可以有的属性

  • 比重 weight:各个子view所占的比例

注意:

LinearLayout 规定了某个方向排列后,orientation在这个方向上的作用的优先级是最高的。

这意味着某些位置相关的属性将失效。

比如orientation=vertical垂直,则layout_gravity=top/bottom/center_vertical无效,left/right仍有效


Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC