1. 相对布局(重点)
1.1 相对布局窗口内子组件的位置总是相对兄弟组件、父容器来决定的,因此叫相对布局
1.2 如果A组件位置是由B组件的位置决定的,Android要求先定B组件,再定义A组件
如果A组件位置是由B组件的位置决定的,Android要求先定B组件,再定义A组件
如果A组件位置是由B组件的位置决定的,Android要求先定B组件,再定义A组件
1.3 id型
@+id和@id的区别
@+id/x1(添加新ID)____android:id="@+id/but_main_blue"
@id/x1(引用此ID)___android:layout_toRightOf="@id/but_main_blue"
相对于指定元素(根据ID指定)
2. 网格布局
2.1 常用属性
GridLayout布局相关属性:rowCount、columnCount
GridLayout中子控件相关属性:layout_gravity="fill_horizontal|fill_vertical"
2.2 Space标签的作用:挡住控件,让其不超出网格的范围
<Space android:layout_width="wrap_content" android:layout_height="wrap_content"/>