Gerardo
Gerardo

Reputation: 5830

Android ListView set Number of items to show

How can i set the number of items to show in a list without to scroll?

Example: I have a list with 10 items. I want that only 3 items appears and that I have to scroll to see the rest of the items.

Upvotes: 3

Views: 5356

Answers (2)

Haider Malik
Haider Malik

Reputation: 1771

just do:

list.remove(3);
list.remove(4);
...
list.remove(9);

in the constructor of the listview adapter.

Upvotes: 0

Janusz
Janusz

Reputation: 189484

I think the amount of Items shown in the Listview depends on the size that is available for the list. I would try a layout that limits the size of the list. It could be possible that such a detailed layout is not possible very easily, a different screen size could show more items etc.

Upvotes: 2

Related Questions