-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
  • 15
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,756
  • 4
  • 37
  • 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,806
  • 1
  • 23
  • 41