范例:
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/cannybt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_marginLeftPercent="1%"
app:layout_marginTopPercent="30%"
android:onClick="cannybtnClick"
android:text="canny" />
</android.support.percent.PercentRelativeLayout>
还得在的dependencies里面添加与之对应的compile 'com.android.support:percent:28.0.0'