Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical Layout, 2 Elements, Make the Top One Fill the Remaining Space (Bottom One Has wrap_content)

I have the following dilemma. Two elements, one on top of each other. The bottom has wrap_content for height. I want the top element to fill the remaining space without the two elements overlapping (which happens if I use FrameLayout for example).

The width is match_parent for all elements.

Here's a mockup (some attributes truncated for clarity):

<LinearLayout android:layout_height="match_parent">

  <CustomView android:layout_height="???????" /> 

  <TextView android:layout_height="wrap_content">

</LinearLayout>
like image 268
Dzhuneyt Avatar asked Oct 25 '25 08:10

Dzhuneyt


1 Answers

<CustomView 
    android:layout_height="0dp"
    android:layout_weight="1"
    .../>
like image 111
Geobits Avatar answered Oct 26 '25 22:10

Geobits



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!