flexbox-layout
flexbox-layout copied to clipboard
Cannot access current FlexLine from ItemDecoration.getItemOffsets
I'm trying to implement a custom ItemDecoration
to assign offsets for each item (somewhat similar to FlexboxItemDecoration
). To calculate the offsets in getItemOffsets
I need to know the relative position of the item in the current flex line.
The problem is at the moment when getItemOffsets
is called the current FlexLine
is not added yet to FlexboxLayoutManager.getFlexLinesInternal()
and I've found no other way to get the relative position.
Would it be possible to add the current FlexLine
to list before getItemOffsets
gets called or provide some other way to obtain item position in a flex line?
Just for illustration, this is kind of layout I'm trying to achieve:
Hi @technoir42
Unfortunately it's not possible at this moment. I tried the similar implementation, but realized it needs to access the package private members of the ViewHolder, which aren't exposed.
So I recommend to use FlexboxLayout at this moment.
Please let me know if something is not clear.