Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)
Is there any way to scroll a ScrollView programmatically to a certain position?

I have created dynamic TableLayout which is placed in a ScrollView. So I want that on a specific action (like clicking a Button, etc.) the particular row should scroll automatically to a top position.

Is it possible?

1 Answer

0 votes
by (46k points)

Try:

ScrollView sv = (ScrollView)findViewById(R.id.scrl);

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

or

sv.scrollTo(5, 10);

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...