-1

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?

3 Answers3

0
android:gravity="center"

post that in the xml

Rik
  • 511
  • 5
  • 16
0

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.

Community
  • 1
  • 1
Teo Inke
  • 5,928
  • 4
  • 38
  • 37
0

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.

Scott
  • 1,863
  • 2
  • 24
  • 43