安卓入门.RelativeLayout相对布局1
16lz
2021-01-23
RelativeLayout相对布局所谓相对布局,即第二个控件的摆放,为第一个控件的相对位置<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF0000" android:text="第一个" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#00ff00" android:text="第二个" android:layout_toRightOf="@id/textView1"//控件摆放在id为textView1控件的右边 />@id,为引用一个已经创建好的控件id@+id,为创建一个新的控件idandroid:layout_toLeftOf摆放在左边android:layout_below摆放在下边android:layout_above摆放在上边android:layout_alignRight="@id/textView1"对齐到右边
更多相关文章
- Android设置任何控件透明度
- Android 控件及其属性2
- Android学习笔记06-线性布局LinearLayout
- Andorid学习笔记(ADT)-常见的UI布局
- Android四大布局
- Android 布局中如何使控件居中
- AS Layout布局