What is the maximum number of items in gridview

假装没事ソ 提交于 2020-01-16 18:18:12

问题


I want to display 15,000 items(images) in grid view, can I load all images at once in grid view From SD card. Please help me on this.


回答1:


You could write code to load all 15,000 of them at once, if that's what you're asking. However, I can guarantee you that you'll run into an OutOfMemoryException before you load too many.

To get around this, you should lazy load the images, as this will only load the ones you need.




回答2:


You can implement the lazy loading concept to load the images in gridview. Get all the image path or by limitation. The preferable was get the data in cursor using limit and load the images in imageview when they are seen on screen. this thing you can implement in Adapter to load images those which are current displayed.

check out the links

http://blog.jamesbaca.net/?p=67



来源:https://stackoverflow.com/questions/12598701/what-is-the-maximum-number-of-items-in-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!