Reputation: 21
I have a horizontal scroll view placed below a map The map has some markers and the horizontal scroll view contains images for each of the markers.
Now, when ever user clicks a maker,I want the horizontal view to scroll and image for that marker to come to the center. This could have been a bit easier with the gallery view, but since that has been deprecated, how shall I go about it now?
Upvotes: -1
Views: 673
Reputation: 1922
Use android:gravity="center"
in your layout.xml
file to center all the images in the scrollView
.
Use yourScrollView.scrollTo(x,y)
to automatically select the relevant image.
Upvotes: 0
Reputation: 5986
If I understood your question, you want to manually scroll your ScrollView to a specific position.
You should use the scrollTo() method to perform that. Take a look at this question which has an example.
Upvotes: 0