<com.abner.ming.myappli.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"
android:textColor="#000"
app:layout_marginLeftPercent="10%"
/>
</com.abner.ming.myappli.PercentRelativeLayout>
layout_widthPercent
layout_heightPercent
layout_marginPercent
layout_marginLeftPercent
layout_marginTopPercent
layout_marginRightPercent
layout_marginBottomPercent
layout_marginStartPercent
layout_marginEndPercent
layout_aspectRatio
<resources>
<declare-styleable name="PercentLayout_Layout">
<attr format="fraction" name="layout_widthPercent"/>
<attr format="fraction" name="layout_heightPercent"/>
<attr format="fraction" name="layout_marginPercent"/>
<attr format="fraction" name="layout_marginLeftPercent"/>
<attr format="fraction" name="layout_marginTopPercent"/>
<attr format="fraction" name="layout_marginRightPercent"/>
<attr format="fraction" name="layout_marginBottomPercent"/>
<attr format="fraction" name="layout_marginStartPercent"/>
<attr format="fraction" name="layout_marginEndPercent"/>
<attr format="fraction" name="layout_aspectRatio"/>
</declare-styleable>
</resources>