Code example for ScrollView

Methods: scrollTo

0
 
    public void restoreState(@Nonnull final ScrollView scrollView) {
        scrollView.post(new Runnable() {
            @Override 
            public void run() { 
                scrollView.scrollTo(scrollX, scrollY);
            } 
        }); 
 
    } 
 
    public static void saveState(@Nonnull Bundle out, @Nonnull final ScrollView scrollView) {
        out.putSerializable(SCROLL_VIEW_STATE, new ScrollViewState(scrollView));
    } 
 
    public static void restoreState(@Nonnull Bundle in, @Nonnull final ScrollView scrollView) {
        final Object o = in.getSerializable(SCROLL_VIEW_STATE);
        if (o instanceof ScrollViewState) {
            ((ScrollViewState) o).restoreState(scrollView);
        }