在Android的Pinterest的风格列表视图或gridview的

在Android的Pinterest的风格列表视图或gridview的

问题描述:

我期待实现Pinterest的风格的GridView(见图片)和我有困难想出的办法。

I am looking to implement pinterest style gridview (see image) and am having difficulty coming up with an approach.

视图需要有3列(如Pinterest的)具有恒定的宽度,但高度可变的单个图像。它应该是可滚动的。我也关注了能够回收的意见,图像的数量可以是很多问题(比如1000)

The view needs to have 3 columns (like pinterest) with individual images having constant width but variable height. It should be scrollable. I am also concerned about the issue of being able to recycle views as the number of images can be lot (say 1000s)

我不知道如何处理这种观点的机器人。

I am not sure how to approach this view in android.

拉​​夫

我从来没有想过这个问题,直到你提出来的,但是这是一个有趣的问题来尝试解决一个。我的建议是,以适应3 的ListView 的进入活动或片段。我想每个人分别回收自己的看法的。这解决了你的表现pretty的容易假设它是安全的这样做。所以,也许一个水平LinearLayout中保存3个列表视图。添加一些填充到中间的人会产生预期的效果。

I never thought about it until you brought it up, but this is an interesting problem to try an solve. My suggestion would be to fit 3 ListView's into the Activity or Fragment. I assume each one recycles their own View's respectively. This solves your performance pretty easily assuming it is safe to do it. So maybe a horizontal LinearLayout that holds the 3 ListViews. Adding some padding to the middle one would produce the desired effect.

当然,更多的思考需要投入决定了图像的方式结束了他们在哪里,但就是你要弄清楚:)希望这给你一些想法!

Of course, more thought needs to be put into deciding how the images end up where they are, but that is you to figure out :) Hope this gives you some ideas!