the Percentage Layout of Android (安卓的百分比布局)

不用wrap_content.match_parent来指定 控件的大小,

1.在app/bulid.gradle文件的dependencies中添加

compile 'com.android.support:percent:24.2.1(注意在添加文件之后要同步一下)

2.修改布局文件xml文件中的布局

比如<Button android:id="@+id/button1"

android:text="button 1"

android:layout_gravit="left|toop"

app:layout_widthPercent="50%"

app:layout_heightPercent="20%"

/>

posted @ 2018-11-15 13:42  拎着红杯子的黄鸭子  Views(178)  Comments(0Edit  收藏  举报