I need to scroll 2 parallel HorizontalScrollView dependently, which means that if I'm scrolling one, the other one should scroll too.
How can I do such a thing?
Thanks in advance.
I need to scroll 2 parallel HorizontalScrollView dependently, which means that if I'm scrolling one, the other one should scroll too.
How can I do such a thing?
Thanks in advance.
hscrollViewOne=(HorizontalScrollView)findViewById(R.id.hsvOne);
hscrollViewTwo=(HorizontalScrollView)findViewById(R.id.hsvTwo);
hscrollViewOne.setOnScrollChangeListener(new View.OnScrollChangeListener() {
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
hscrollViewTwo.scrollTo(scrollX, scrollY);
}
});
hscrollViewTwo.setOnScrollChangeListener(new View.OnScrollChangeListener() {
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
hscrollViewOne.scrollTo(scrollX,scrollY);
}
});