Pinterest的网格状Android中网格、Pinterest、Android

2023-09-05 23:27:17 作者:余音冷断空旧故

我想建立像在Pinterest的应用程序在Android上的网格。

I want to build a grid like the one in Pinterest app on Android.

我开始延伸的适配器视图< ListAdapter> ,但我不能做很多事情的工作(例如overscroll效果),因此,放弃这个想法后,延长 AbsListView ,现在我开始以为这是更好地扩展的ListView 并覆盖 layoutChildren()方法。

I started extending an AdapterView<ListAdapter> but I cannot make many things working (for example the overscroll effect) so, after abandoning the idea to extend AbsListView, now I am starting thinking it is better to extend a ListView and override the layoutChildren() method.

你怎么看?

感谢

推荐答案

我已经通过复制和更新Android的StaggeredGridView解决了这个。 https://github.com/maurycyw/StaggeredGridView 。好像创造你正在寻找的影响工作的伟大。在此之前,我去了复制Android的源代码,以独立的库(这是我得到的工作)的兔子洞,直到我看到了现在的实验StaggeredGridView。它比我老BrickView库项目要简单得多,所以我取代了它。

I have solved this by copying and updating Android's StaggeredGridView. https://github.com/maurycyw/StaggeredGridView . Seems to work great for creating the effect you are looking for. Before this I went down the rabbit hole of copying Android's source to a separate library (which I got working) until I saw the now experimental StaggeredGridView. It is much simpler than my old "BrickView" library project so I replaced it.