android-flowlayout icon indicating copy to clipboard operation
android-flowlayout copied to clipboard

Support for `setAdapter` ?

Open chakrit opened this issue 11 years ago • 6 comments

So it is possible/simpler to build child views using the standard Android's Adapter pattern.

chakrit avatar Mar 23 '14 19:03 chakrit

This is what I use right now:

FlowLayout newsFlow = views.find(view, R.id.flow_news);
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
    newsFlow.addView(adapter.getView(i, null, newsFlow));
}

But obviously this logic belongs in the flow layout, not the activity or fragment that's using it. There are also other nuances that'll be needed such as auto-updating when the backing store gets updated with new items.

chakrit avatar Mar 23 '14 19:03 chakrit

+1 for this

gengjiawen avatar Dec 11 '14 03:12 gengjiawen

Please add adapter feature.

frodberserk avatar Apr 01 '15 05:04 frodberserk

That would be neat. I imagine that would not be easy, but it would be cool. I did something similar.

On Wed, Apr 1, 2015 at 12:06 AM, frodberserk [email protected] wrote:

Please add adapter feature.

— Reply to this email directly or view it on GitHub https://github.com/ApmeM/android-flowlayout/issues/14#issuecomment-88351603 .

neiljaywarner avatar Apr 01 '15 13:04 neiljaywarner

Sorry, I have tried to understand how adapters should work inside the layout but failed. Can somebody create a pull request for this issue (at least for horizontal view without gravity etc, as an example so I can extend it and add to this project).

ApmeM avatar Sep 23 '15 13:09 ApmeM

Now with recycling view setAdapter can be used.

ApmeM avatar Sep 30 '15 13:09 ApmeM