xml - Android Measure Screen in percentage -
i did many research on android layouts found many answers not found answer tells me how can measure screen in actual percentage found table layouts linear weight, best 1 linear weight difficult manage percentage again!!!
percentage means ratio out of 100
linear layout weight not difficult manage can technically manage linear layout in percentage this,
let suppose main layout android:weightsum=”100” mean total screen size 100% can specify every layouts width
example
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:id="@+id/layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightsum="100" > <textview android:id="@+id/one" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="12" android:background="#ff9933" android:text="no:" /> <textview android:id="@+id/two" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="63" android:background="#cc33cc" android:text="desc" /> <textview android:id="@+id/three" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="25" android:background="#ff9999" android:text="total" /> </linearlayout>
according percentage first column 12% second 63% , last 1 25%
Comments
Post a Comment