Search code examples
androidandroid-layoutandroid-recyclerviewstaggeredgridlayoutandroid-wrap-content

RecyclerView with wrap content items


I need to implement next UI element:

enter image description here

  • Unknown size list of strings (That came from a server call)
  • Any item should be wrap content.
  • If an item is not fits to row, he will be in the next row.
  • All list/grid is centered

I thought of using RecyclerView with StaggeredGridLayoutManager

But I don't know if it the right way, any ideas?


Solution

  • I don't sure that method would be helpful for you, but instead of

    using RecyclerView with StaggeredGridLayoutManager

    you can use third-party FlowLayout:

    1. First implementation (Android flow layout)

      enter image description here enter image description here

    2. Second implementation (Flow layout)

      enter image description here

    Check this gist for full example:

    https://github.com/davidbeloo/Hashtags

    enter image description here