Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Use Adapter While Filling Layouts

I know it may be weird that I want to succeed.

Let me explain whole in details. Firstly, I want to use two ListView looking in an Activity screen. Just like how Pinterest looks like. (I'm not sure is it true but it's named as heterogeneous gridview.) There is also one thing that I needed to implement: lazy loading. There are about 30 images in my activity, so that's not good to fetch all images at one time. That's why I needed lazy load.

So in first, I pondered on that I how obtain that appearance, I mean heterogeneous gridview. Then decided to add to LinearLayout in a ScrollView. Linears have vertical orientation. With thay approach, I added my new views by using odd-even method in Linear Layouts.

Althought, there weren't any adapter so according to my knowledge, there is no way to controll which items would be displayed. So lazy load is not suitable.

I've also tried two ListView in an Activity, but got some lag and also synchronous scroll problems. On the other hand it has a bad recycling.

So in this scenario, I want to ask is there way to fill LinearLayouts using Adapter? Or what would you recommend to create a heterogeneous gridview but also with lazy load.

If my approaches are wrong, I would not hasitate to change it.

Any clue would be great for me. If there is something unclear, please specify it. I'll explain with more details.

like image 908
Ogulcan Orhan Avatar asked Jan 21 '13 09:01

Ogulcan Orhan


2 Answers

After a lot of research, finally I found a library which have lazy loading and heterogeneous gridview and also not has any scroll or recycling lags/problems.

Maurycy's StaggeredGridView is completely what I'm looking for.

Here is the library and also there is a demo too.

like image 179
Ogulcan Orhan Avatar answered Nov 15 '22 10:11

Ogulcan Orhan


If I get your question right, here is what you need: http://spinlist.autsia.com/

like image 36
Dmytro Titov Avatar answered Nov 15 '22 12:11

Dmytro Titov