I want to build a grid like the one in Pinterest app on Android.
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.
What do you think?
Thanks
We won’t be needing any external library for this as Android’s native RecyclerView makes implementing a Pinterest masonry layout simply by changing the RecyclerView’s Layout Manager
Cool. it's Very easy ,but margin on my LinearLayout didn’t seem to work. So here’s a quick fix.
SpacesItemDecoration class:
Github link of example
This can be achieved by small change to existing recyclerview and it's adapter
Change to be done are : 1.In you Activity / Frgament
2.Your Recyclerview list item is :
By doing this you can achieve what you are looking for!
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.