android - Synchronize scrolling of two ScrollViews inside a RelativeLayout -
i need synchronize scrolling positions of 2 scrollviews
.
both scrollviews
contain individual recyclerview
(i can't put them inside same scrollview due design requirements).
how can achieve that?
i highly recommend change design there way achieve this
for first scroll view, define 2 variable x,y , current scroll position
x = firstscrollview.getscrollx(); y = firstscrollview.getscrolly();
and pass these values other scrollview "scrollto" method.
like:
scrollview secondscrollview = (scrollview)findviewbyid(r.id.scrollview); secondscrollview.scrollto(x, y);
if didn't work try:
secondscrollview.post(new runnable() { @override public void run() { secondscrollview.scrollto(x, y); } });
Comments
Post a Comment