Search code examples
androidhorizontalscrollview

android horizontal scrollview


I am using Horizontal Scrollview in android to show images in my app,

i need to make it scroll exact to the initial of the next or previous image on the user's left or right gesture, how it can be solved, it has a linear layout (orientation horizontal) and images are loaded in that,

thanks


Solution

  • there is no property / method / attribute of scroll view which let you do what you want trivially. but the good news is that the solution is simple - don't use scroll view, but views that design for such purpose:

    ViewPager

    ViewSwitcher

    ViewFlipper and example here

    Gallery

    these three view design for showing and navigating between views with horizontal gestures.
    they got attributes / properties / method to control number of view on screen.