I have infinite number of items. Want to display them in two columns as a GridView with lazy loading. I tried it with GridView, which is displaying all items in a row with the same height. But want it to be adjusted according to the item height as in the attached image. If anyone have any idea or any of u have implemented this with some customized View. Please share it across. Thanx in advance.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
New answer
Look at the RecyclerView
. The RecyclerView
replaces ListView
and is designed to be flexible enough to support your use case.
RecyclerView
is a part of the support library, added in android L. So it should work on any version of Android. But beware, at the time of this writing, android L is in preview.
Original answer
There is an experimental class in the Android source code called StaggeredGridView
that does what you want. It is contained in frameworks/ex/widgets/
folder.
It isn't finished yet. However, some people have built working prototypes based off it. Ex: http://www.androidviews.net/2013/01/pinterest-like-adapterview/