qingy2019
qingy2019

Reputation: 644

Why does smoothScrollTo() not scroll to the bottom?

I'm just wondering what this does.

I've tried using:

scrollView.smoothScrollTo(0, scrollView.bottom)

, but it doesn't even scroll all the way to the bottom...

Thanks

Upvotes: 1

Views: 230

Answers (1)

Kamal Nayan
Kamal Nayan

Reputation: 1718

Try to use the code below. It should work for you.

scrollView.post(new Runnable() {
    @Override
    public void run() {
        scrollView.smoothScrollTo(0, scrollView.bottom);
    }
});

Kotlin:

scrollView.post { scrollView.smoothScrollTo(0, scrollView.bottom) }

Feel free to ask if something is unclear.

Upvotes: 1

Related Questions