I am looking to implement pinterest style gridview (see image) and am having difficulty coming up with an approach.
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.
Gaurav
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!
I would do it this way:
ScrollView
LinearLayout (horizontal)
LinearLayout (vertical, layout weight for width)
[All the content in column 1]
LinearLayout (vertical, layout weight for width)
[All the content in column 2]
LinearLayout (vertical, layout weight for width)
[All the content in column 3]
Use lazy loading for the pictures if there are thousands
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With