3.5学习总结
今天学习了布局2RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="100dp"> 设置组件内部元素的边距
<RelativeLayout
android:id="@+id/rl"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#ff0000"
android:layout_centerInParent="true" /> 根据父容器定位
<RelativeLayout
android:layout_width="100dp"
android:layout_margin="50dp" 设置组件与父容器的边距
android:layout_height="100dp"
android:background="#00ff00"
android:layout_toLeftOf="@+id/rl" 根据兄弟容器定位
/>
</RelativeLayout>

浙公网安备 33010602011771号