6

I want to implement a Tag Cloud with Android Chips.

enter image description here

But i think the best way to do this is with a RecycleView and a custom LayoutManager. I search for a LayoutManager which layout its children like a FlowLayout but found nothing.

Has someone found this kind of behavior or a good and simple tutorial about custom layout managers? I found no simple or simple but incomplete articles.

enter image description here.

Happo
  • 1,375
  • 3
  • 16
  • 34

2 Answers2

11

I found a library that does this.

You have add this line to your Gradle depencencies:

compile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'

and set your recycler view layout manager with it:

recyclerView.setLayoutManager(new FlowLayoutManager());

You have additional details on how to configure it on Github: https://github.com/xiaofeng-han/AndroidLibs/tree/master/flowlayoutmanager

Glacoon
  • 111
  • 5
  • Yes, this is good, and worked fine, but how can I use this library for older versions e.g. earlier APIs/SDK before 16, because it need minimum SDK 16, but I want to apply it on SDK 11 too, how it be possible. – Zia Ur Rahman Sep 29 '16 at 15:46
  • 4
    I had to call `.setAutoMeasureEnabled(true)` on the manager, then it works great! – arekolek May 10 '17 at 16:03
5

You may try my library. See github description page for detailed features/usage.

It provides behavior which exactly you want. Its min sdk is 15, which covers almost all nowadays devices being used.

Also it is still maintained, so you can receive additional support from me

Beloo
  • 9,723
  • 7
  • 40
  • 71
  • 1
    Uff, unfortunately, filling or even centering the contents on fill view is not possible, issues are being ignored since 2019, so I guess it's not maintained, anymore. – Martin Braun Mar 28 '21 at 01:32