Search code examples
javaandroid-layoutuser-interfacefloating

How can I have a floating view to fit in multiple rows with variable number of textviews?


I want to have a list of labels related to each post in my app shown behind the post. It may have varying number of labels per row depending on the number of labels and whether they fit in same row or not. Like this sample picture. Plus, I'm not expert in frontend development!

enter image description here


Solution

  • What you are looking for is called flexbox-layout

    FlexboxLayout is a library project which brings the similar capabilities of CSS Flexible Box Layout Module to Android.

    Please notice - in the GitHub page is it mentioned that from version 1.1.0 you will have to use AndroidX:

    Note that starting from 1.1.0, the library is expected to use with AndroidX. Please migrate to AndroidX if you use 1.1.0 or above.