如何同时同步滚动视图

时间:2012-02-09 15:06:02

标签: android scrollview

我使用Synchronise ScrollView scroll positions - android来同步2个滚动视图。我这实现了一个接口

protected void onScrollChanged(int x,int y,int oldx,int oldy);

现在任何人都可以告诉我如何使用这个接口或任何其他方法同时同步四个视图,因为in-build方法中的onScrollChanged()并且只使用2个滚动视图的坐标。但我必须滚动4个视图。如果有任何方法请告诉我。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我猜你可以做点什么

    if(scrollView == scrollView1) {
        scrollView2.scrollTo(x, y);
        scrollView3.scrollTo(x, y);
        scrollView4.scrollTo(x, y);
    } else if(scrollView == scrollView2) {
        scrollView1.scrollTo(x, y);
        scrollView3.scrollTo(x, y);
        scrollView4.scrollTo(x, y);
    } else if(scrollView == scrollView3) {
        scrollView1.scrollTo(x, y);
        scrollView2.scrollTo(x, y);
        scrollView4.scrollTo(x, y);
    } else if(scrollView == scrollView4) {
        scrollView1.scrollTo(x, y);
        scrollView2.scrollTo(x, y);
        scrollView3.scrollTo(x, y);
    }
相关问题