0

I have scrollable horizontal RecyclerView filled with same size items.

I need to change behaviour of that ViewGroup and have 4 requirements:

  • not scrollable
  • as many items as space left (all items needs to be displayed with full size)
  • if there is more items to display than space left - show "ellipsize" item at the end
  • items takes equal space (similar to layout_constraintHorizontal_chainStyle=”spread”)

I tried to play with Flexbox-layout but I am not sure if this is a correct tool to achieve it. Also before I started trying to implement it by myself (measure; add item if space left > item.size), I wanted to ask if there is already easy solution for this.

Bresiu
  • 2,123
  • 2
  • 19
  • 31

1 Answers1

0

I have created EllipsizeViewGroup for that. Layout is based on LinearLayout. You can add more views dynamically.

https://github.com/Bresiu/EllipsizeViewGroup/blob/master/app/src/main/java/com/bresiu/ellipsizeviewgroup/EllipsizeViewGroup.kt

Bresiu
  • 2,123
  • 2
  • 19
  • 31