android studio布局种类

来源:互联网 发布:办公软件的运用 编辑:程序博客网 时间:2024/06/05 06:22

四大布局种类:LinearLayout-线性布局、RelativeLayout-相对布局、FrameLayout-帧布局、TableLayout-表格布局

(1)LinearLayout

属性:

android : orientation="horizontal"(默认,水平布局)、"vertical"(垂直布局)

background="颜色"

layout_width/height="match_parent"-填充父件、"wrap_content"-包裹子件

vertical布局对齐方式(left,center,right)

horizontal对齐方式(top,center,bottom)

layout_weight-比例等分(vertical有效)

注意,多个流式分布要wrap在相对分布中,不然重叠

(2)RelativeLayout-相对分布