Reputation: 39
I only set the num columns in properties of a GridView. Nowhere to set the number of items
I google but only got some questions about how to fix the rows of GridView. I looking for in API GridView also, but there is no function to do that.
Someone teach me? Thanks
Upvotes: 2
Views: 1453
Reputation: 4936
You cannot set the number of items directly on a grid view. This has to be done using its adapter and set the number of items in the adapter.
Usually a variable/array holding the items is created before an adapter is passed to the grid. This will populate the grid accordingly.
To be specific, this is the adapter function
@Override
public int getCount() {
return "HOW MANY ITEMS YOU WANT TO SHOW";
}
Upvotes: 2