In my activity I have a scroll view which contains a linear layout that has many views. Is there a way I can display a specific view (from the linear layout) when starting this activity? By default this view is hidden, so I must scroll the scroll view to make it visible.
Asked
Active
Viewed 1,770 times
2 Answers
4
Scroll the view to the view you want to show:
scrollView.smoothScrollTo(0, specificView.getTop())
See Is there a way to programmatically scroll a scroll view to a specific edit text?

Community
- 1
- 1

Sofi Software LLC
- 3,879
- 1
- 36
- 34
-
View.getTop() was what I needed! – Alan Apr 30 '13 at 21:04
0
-
-
1Let's say that I have a scroll view with 100 views, but maximum 4 views are visible at a certain moment. To see other views you have to scroll, right? Well, I would like the scroll view to be scrolled, when the, activity is displayde, to a specific view (89, for exxample). It has nothing to do with the setVisibility method. – Gratzi Jul 11 '11 at 06:39
-
ok! Thanks for the comment. Did you try [requestFocus](http://developer.android.com/reference/android/view/View.html#requestFocus%28%29)? – coffee Jul 11 '11 at 12:25