how to put multiple adapter inside one adapter
I need to make a custom ListView开发者_如何学C
with multiple view types. I found this link: http://umakantpatil.com/posts/android-listview-with-separate-headers-and-images-loading-from-remote-server
But the problem is: It divides the list into sections and creates a single view type. My first question is: How can I modify this code so that I could retrieve my each row with a different type? I mean I want to have a section but I want the items come in a different manner.
My second question is: How can I do that? I thought of two adapters: one to hold a raw view type and one to hold another to set for my listview. How can I that?
Thanks
If I understood what you're trying to accomplish, then I believe I may be able to help you. See here.
When it comes to custom adapters (headered lists, custom-mixed lists etc.), the easier solution in my opinion is SeparatedListAdapter
by Jeff Sharkey. By easier I mean "the least amount of code to implement". You may run into problems because that code is GPL'ed v3.
I achieved an excellent solution implementing cwac-merge by CommonsWare. It's ASL 2, so you're good to go if you're thinking about Android market. You can add any adapter, as well as View
s directly. It's very, very good. I really recommend it.
You can check more details in my question. If you have any doubt about how to implement, post here and I will try to help.
And by the way, try to improve your record by going into your profile and accepting the answers provided to your questions (in case they actually helped you).
精彩评论