Actually i got a Gallery that shows my drawables and shows the item selected on the center of the screen.
I would like my selected item to be “off-center” (e.g: positioned 50dip on the left).
I tried to add some padding on the view and on the gallery. I also verified that the gravity of my gallery wasn’t set in “center”
By the way, I guess that the usual behaviour of the gallery is to show selected item on the center of the screen.
Is there any possible means to shift the position of the selected item ?
Thanks a lot ! If needed, I can add my code.
I got the answer finally.
First, you have to set ScrollX to a certain value corresponding to the interval of pixels you wanna have.
But the problem with that only solution is that to select an item, you need to click on the center of the screen, which isn’t fair.
Second, you must override Gallery, implement this one OnDoubleTapListener and add him a custom listener (called for instance onItemTapListener) like this :
I made an interface like this to implement my new listener :
And on the event “onSingleTapConfirmed” implemented because of the implementation of OnDoubleTapListener, you catch the event and verify that event.getX() is into a certain position, like this for instance :
Where intWidth is the width in pixels of the current screen.