FrameLayout : Fill empty space
android, android-layout
Solution
you can use the `layout_weight="1"` property for the central `FrameLayout`, leaving `0dip` for the `height`. It will the take the space left from the other two
Problem
I have 3 `FrameLayout` in my layout, the first and the third have a fixed height (wrap_content of child views). And I want the second `FrameLayout` to fill remaining space between the first and the third element. My XML : ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal" > <!-- ... childs views with fixed height --> </FrameLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" <!-- Fill remaining space --> android:layout_marginBottom="5dp" android:layout_marginTop="5dp" > <!-- ... childs views with match_parent height --> </FrameLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <!-- ... childs view with fixed height --> </FrameLayout> </LinearLayout> ```