android studio基础布局之一百分比布局
<?xml version=”1.0″ encoding=”utf-8″?>
<androidx.percentlayout.widget.PercentRelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
xmlns:app=”http://schemas.android.com/apk/res-auto”>
android:layout_width=”0dp”
android:layout_height=”0dp”
app:layout_heightPercent=”30%”
app:layout_widthPercent=”70%”
android:orientation=”vertical”
android:id=”@+id/one”
android:background=”#fffaaa”
>
android:layout_width=”match_parent”
android:text=”test1″
android:background=”#fffaaa”
android:gravity=”center”
android:layout_height=”50dp” />
android:layout_width=”match_parent”
android:text=”test2″
android:background=”#dedede”
android:gravity=”center”
android:layout_height=”50dp” />
android:layout_width=”match_parent”
android:text=”test3″
android:background=”#fffaaa”
android:gravity=”center”
android:layout_height=”50dp” />
android:layout_width=”0dp”
android:layout_toRightOf=”@id/one”
android:layout_height=”0dp”
app:layout_heightPercent=”30%”
app:layout_widthPercent=”30%”
android:gravity=”center”
android:background=”#fffaad”
android:text=”test4″
/>
android:layout_width=”0dp”
android:layout_below=”@id/one”
android:layout_height=”0dp”
app:layout_heightPercent=”70%”
app:layout_widthPercent=”100%”
android:gravity=”center”
android:text=”test5″
android:background=”#dedede”
/>
</androidx.percentlayout.widget.PercentRelativeLayout>
