开发者

How to page a gridviews in android?

I would like to create pages of gridview in android.

The page 1 will have a 3x3 set of elements.

On clicking the next button it should jump to page-2 with the next 3x3 set of elements.

Right now i have a grid of 3x3 elements and when i give a set of 12 elements, a scrollbar will appear in the right side of the gridview and the next three elements will be show开发者_运维技巧n in the same page by scrolling down.

So please help on how i can implement a page of gridviews.

Thanks,

Sen


Limit the number of items you pass to the gridview adapter. Assuming that you have an array of items, in your newInstance() method, select from that array 9 elements according to the page. Then pass that array to the gridview adapter. Also, let your getCount method in your gridview adapter return 9.

Sorry I don't give code right now, but if it isn't clear, I will provide done snippets when I have pc access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜