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%"

/>

猜你喜欢

转载自www.cnblogs.com/1521681359qqcom/p/9963054.html