How do I make a bi-directional RecyclerView?

I need to do bi-directional RecyclerView

. Basically, it will scroll vertically, but each line will be a horizontal list of chunks that could scroll. The starting position of the scroll will be top and left. User could scroll down and scroll to the right with each line.

Any ideas on how to do this? (for example, using a custom LayoutManager

or intercepting a touch event).

+3


source to share


1 answer


I managed to solve the problem using a custom implementation of the view.

At the root, I have a custom one ScrollView

; when called onMeasure

, ScrollView

informs his children how tall they are. In this case, they are half the height ScrollView

. The width matches the height, so they appear as square tiles.



Each of the children ScrollView

has RecyclerView

a horizontal LinearLayoutManager

. Since ScrollView

it tells each child how tall there is no problem with the measurement, and they actually scroll very well in both directions (vertically and horizontally).

sample of solution

+1


source







All Articles