Android bottom panel

How can I have a layout where there is a view that occupies most of the upper part of the screen, and the lower panel below it at the bottom of the screen, without directly setting the size from above?

+3
source share
1 answer

You can set the top view android:layout_weightto "1", then you can set the bottom height of the view, and the top view will take up all the remaining space. For example:

<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_weight="1" />
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="25dip" />

(Of course, if there is content in the lower view, you can simply set the height to "wrap_content" and set its own size based on its content.)

+10
source

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


All Articles