How to fill the remaining space between two layouts

I have a problem with Android layouts.

In my XML file, I have two relative layouts. One is attached to the top using android: layout_alignParentTop = "true".

Another is attached to the bottom of the android: layout_alignParentBottom = "true".

Now there is a lot of space between the two views. I would like the two to fill this remaining space using FrameLayout, where several different fragments should be displayed.

Does anyone know how to fill the space that I described?

Thanks a lot!

+4
source share
2 answers
<FrameLayout android:layout_below="@+id/toplayout" android:layout_above="@+id/bottomlayout"/> 
+5
source

add a frame layout and set its property

 < android:layout_above="@+id/top" android:layout_below="@+id/bottom" > 

therefore, the frame layout will occupy all the space between these two layouts

+1
source

Source: https://habr.com/ru/post/1401354/


All Articles