1

How to auto scroll bottom-to-top at a particular position in ScrollView to make it look like as Drag-to-scroll-up in ScrollView?

Basically, I want to create a wheel that spins from bottom to top with smoothly.

rupinderjeet
  • 2,984
  • 30
  • 54
  • http://developer.android.com/reference/android/widget/AbsListView.html#smoothScrollToPositionFromTop%28int,%20int%29 – Jaimin Modi Oct 28 '15 at 04:50

2 Answers2

2

You can make scrollview to scroll and add some sleep for smooth scrolling :

private void sendScroll(ScrollView scrollView){
        final Handler handler = new Handler();
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {Thread.sleep(100);} catch (InterruptedException e) {}
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        scrollView.fullScroll(View.FOCUS_UP);
                    }
                });
            }
        }).start();
    }
Randyka Yudhistira
  • 3,612
  • 1
  • 26
  • 41
-1

Add the below lines :

scroll.scrollTo(0, scroll.getBottom());

in your XML add:

android:focusable="true"
android:focusableInTouchMode="true"
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96