I have the following
<linearLayout>
<RelativeLayout>
<!-- Header -->
</RelativeLayout>
<linearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="6">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
</linearLayout>
However the layouts are not assuming to fill the height properly I wish to for the desired effect of one linearLayout below another and to take up 1/6th of the parent space.
Instead it seems to be applying the weight to the width of the element.
What is the correct method to assume percentage height in Android? Width seems to be a breeze with Weight but I can't seem to get it correct on Height.
add android:orientation="vertical"
in your LinearLayout
as by default it is android:orientation="horizontal"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With