Here is my xml:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/llRow1" />
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_below="@+id/llRow1"
android:id="@+id/llRow2" />
<LinearLayout android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/llRow3" >
</RelativeLayout>
What i wanna have:
– Those 3 “rows” have to share the screens’ height
– but with one extra: when i set the 3rd row (llRow3) visibility to GONE, only row1 and row2 have to share the screens height.
How is it possible to do this?
Set a the same
layout_weightto all of them. So if you’ll set visibility of the third one to GONE, they’ll still have those weights.Edit:
Change the ParentLayout to LinearLayout or if you need RelitiveLayout, then you can wrap those three LinearLayout in an other LinearLayout and set weights to them like this: