美文网首页Android studio
基础布局之一百分比布局

基础布局之一百分比布局

作者: deanwin | 来源:发表于2020-04-06 16:34 被阅读0次

    <?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>

    相关文章

      网友评论

        本文标题:基础布局之一百分比布局

        本文链接:https://www.haomeiwen.com/subject/ppebphtx.html