Alex
Alex

Reputation: 7067

HorizontalScrollView, auto-scroll to end with animation

I have a horizontalScrollView and I need to make an auto-scroll to end with animation when I load the view. I have implemented this method to do it:

final HorizontalScrollView strip = (HorizontalScrollView) contentView.
    findViewById(R.id.horizontalScrollView1);

strip.postDelayed(new Runnable() {

    public void run() {
        strip.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
    }
}, 1000L);

It works fine, but, the main problem is the animation of the scrolling is too fast and I need to implement a slower scrolling. Have you any idea?

Upvotes: 7

Views: 12039

Answers (2)

Saikat
Saikat

Reputation: 2623

Try this:

ObjectAnimator animator=ObjectAnimator.ofInt(buttonHolderScrollView, "scrollX",targetXScroll );
animator.setStartDelay(100);
animator.setDuration(100);
animator.start();

Upvotes: 5

blessanm86
blessanm86

Reputation: 31779

This is a demo project I created for one of my projects. Its a scroller the scroll automatically and continously. It was made to show a credits screen by continously scrolling through a list of images. This might help you or give you some idea.

https://github.com/blessenm/SlideshowDemo

Upvotes: 6

Related Questions