Android關於百分比佈局-android.support.percent.PercentFram

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

   


    <TextView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_gravity="bottom"
        android:background="#770000ff"
        android:text="Textview"
        android:gravity="center"
        app:layout_heightPercent="10%"
        app:layout_widthPercent="100%"/>




</android.support.percent.PercentFrameLayout>

控件的百分比主要是:app:layout_heightPercent和app:layout_widthPercent這兩個屬性。。一個是寬的百分比,一個是高的百分比。。。很好的適配屏幕。。。。
相關文章
相關標籤/搜索