Gratzi
Gratzi

Reputation: 4703

Set maximum number of visible rows for listview

Is there a way for setting a number of maximum visible rows for a listview?

Upvotes: 5

Views: 8399

Answers (2)

niczm25
niczm25

Reputation: 179

have done it, I used custom adapter and then there i set the height of the row the to my desired height. by setting up the height of the row in listview i can set how many rows can be initially displayed and others are scrollable, where i place the listview inside a layout(relative or linear) and then i setup the height of the layout, with the multiple of how many rows do you want to be seen, ei row height is 50dp your layout height should be 150dp if you want 3 visible rows.

Upvotes: 2

Luke
Luke

Reputation: 492

If you are using a SimpleListAdapter then you should be able to limit the number of rows through the query.

Depends on the situation really. Do you want the user to be able to load say "10 more items" or something?

Upvotes: 0

Related Questions