Lena Bru
Lena Bru

Reputation: 13937

how to make listview height take all available space on the screen

How do I make listview height take all available space on screen, even if there is only one item on the list that is 100dpi tall?

Upvotes: 0

Views: 574

Answers (2)

Christopher Francisco
Christopher Francisco

Reputation: 16268

use match_parent as width and height, and also make sure your background image (if you're using one) is not limiting the height. In that case, if your bg image is larger, the height will go higher and same if smaller. If that's the case, then you should move your background to a parent view like a FrameLayout or a LinearLayout

Upvotes: 0

2Dee
2Dee

Reputation: 8629

Simply set the width and height of the ListView like this :

<ListView 
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ListView>

Upvotes: 2

Related Questions