I
I
Ivan2015-07-06 20:14:42
Android
Ivan, 2015-07-06 20:14:42

How to stretch ListView to full screen?

Good afternoon!
There is a simple layout: text fields at the top and bottom of the screen and a listview between them. It has several elements and on a large screen this view takes up half the screen. How can I stretch it to the entire space between the text fields? In the sense that the size of list items would become larger

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Emin, 2015-07-06
@Ewintory

If you only have a few items, then replace the ListView with a LineralLayout and give all children the same weight, as in Copperfield 's answer .
ListView does not know how to stretch its child elements.

C
Copperfield, 2015-07-06
@Copperfield

Vertical LinearLayout and layout_weight = "1" for ListView.

V
Vladimir Yakushev, 2015-07-08
@VYakushev

Custom adapter for ListView, which in the getView method will set View parameters depending on the content and the number of items in the list.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question