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

Popular posts from this blog

PHP while loop dynamic rowspan -

android - How to read a column value in parse.com without accessing an object or a pointer -

timer - Java TimerTask cancel -