Two Scrolls monitor each other's sliding - stuck problem
①Finger slide Scroll1
②Trigger onScroll of Scroll1
③Call scroller2.scrollBy to slide Scroll2
④Trigger onScroll of Scroll2
⑤Call scroller1.scrollBy to slide Scroll1
Here ⑤ will trigger ②, which will keep looping, causing the stack to burst, which is the error you posted above [Error message: Stack overflow!]
So add a flag:
flag=true means that the finger is sliding Scroll1, and there is no need to use scroller1.scrollBy to slide Scroll1;
flag=false means that the finger is sliding Scroll2, and there is no need to use scroller2.scrollBy to slide Scroll2;
Changing the name of this flag to isTouchScroll1OrScroll2 will be more intuitive.
scroller1: Scroller = new Scroller()
scroller2