Question

I need to achieve a behavior like the last.fm tag cloud on Android.

This means: my items have android:layout_width="wrap_content", and I need to display horizontally until an item doesn't fit horizontally on the View, which will be the first item of the next row. I'd also like to populate the view with a ListAdapter.

Writing such View seems overly complicated. Is there any library project that achieves this effect?

Was it helpful?

Solution

What you're looking for is a FlowLayout. It doesn't exist natively in Android, but Romain Guy (a former Android engineer) gave a talk showing a quick implementation, and there are also several libraries available that you could use, or easily spin your own.

https://github.com/ApmeM/android-flowlayout
https://github.com/blazsolar/FlowLayout
http://nishantvnair.wordpress.com/2010/09/28/flowlayout-in-android/
http://hzqtc.github.io/2013/12/android-custom-layout-flowlayout.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top