Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bottom bar on Android

Tags:

android

layout

How can I have a layout where there is a view occupying most of the top of the screen and a bottom bar below it in the bottom of the screen without setting size for top view directly?

like image 764
Fixpoint Avatar asked Apr 28 '26 07:04

Fixpoint


1 Answers

You can set the top View's android:layout_weight set to "1", then you can set your bottom View's height and the top View will take up all 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 bottom View, you can just set the height to "wrap_content" and have it set its own size based on its contents.)

like image 120
Dan Lew Avatar answered Apr 30 '26 21:04

Dan Lew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!