1

So I have a tutorials app on the play store.

In the tutorials activity I simply have a single textview inside a scrollview. The textview is massive and may contain upwards of 5000 characters. I want to add an option to auto scroll since scrolling so much rubs my fingers raw and I think users may also feel the same since I got a few requests about this feature.

Once again, I want the user to tap the menu button, click the Auto Scroll option and the text should start scrolling smoothly, from wherever it's at to the end.

I found this:

ScrollView autoscrolling

public void scrollRight(final ScrollView h){
  new CountDownTimer(10000, 25) { 
     public void onTick(long millisUntilFinished) { 
        h.scrollBy(1,0);
     }
     public void onFinish() { 

     } 
  }.start();
}

But I have a few doubts about this. Would this keep the user interface reactive? I mean even if it is auto scrolling I want the user to be able to move up or down by flinging all they want while it is still auto scrolling.

Further this might be a bit jittery on some devices, how do I make the scrolling smooth?

Above it runs for ten seconds, but I need it to run indefinitely. Is there a way I can calculate the max time needed to scroll? Or simply using a large number will work equally well? Say 1 million milliseconds?

Eventually I'd let the user set the scroll speed. But I reckon that will be easy once I get the basic auto scrolling right.

Community
  • 1
  • 1
user3139736
  • 51
  • 1
  • 3

1 Answers1

1

This is very similar to something I've tried, yet I've done it with a handler (which can run for as long as you wish).

The original post i've written is here.

about allowing the user to interact, you can temporary disable the auto-scrolling when the user touches it, and re-enable it after the user has stopped (maybe use setOnTouchListener).

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270