dependencies { compile ' com.android.support:percent:22.2.0 '}
Support layout
Percentrelativelayout
<Android.support.percent.PercentRelativeLayoutXmlns: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"> <ViewAndroid:id="@+id/top_left"Android:layout_width="0DP"android:layout_height="0DP"android:layout_alignparenttop="True"Android:background="#ff44aacc"App:layout_heightpercent="20%"App:layout_widthpercent="70%"/> <ViewAndroid:id="@+id/top_right"Android:layout_width="0DP"android:layout_height="0DP"android:layout_alignparenttop="True"android:layout_torightof="@+id/top_left"Android:background="#ffe40000"App:layout_heightpercent="20%"App:layout_widthpercent="30% "/> <view android:id= "@+id/bottom" android:layout_width=< Span class= "Pl-pds" > "Match_parent" android:layout_height= "0dp" android:layout_below=< Span class= "pl-s" > "@+id/top_left" android: Background= "#ff00ff22 " app: Layout_heightpercent= "80%"/></ ANDROID.SUPPORT.PERCENT.PERCENTRELATIVELAYOUT>
Android finally officially supports setting the width of the control by a percentage