1. 程式人生 > >scrollview smoothScrollTo不起作用的問題

scrollview smoothScrollTo不起作用的問題

LinearLayout ll = (LinearLayout) findViewById(R.id.ll);

        final ScrollView hsv = (ScrollView) findViewById(R.id.hsv);
        OnGlobalLayoutListener listener = new OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                hsv.scrollTo(100, 0);
            
} }; ll.getViewTreeObserver().addOnGlobalLayoutListener(listener);