views:

127

answers:

1

Guys,

I'm trying to implement scroll animation for gallery...programmatically.

tried with setSelection(int pos, Boolean animate) and it's not working.

is there anyway to override setSelection() method

Thx Samurai

A: 

Gallery.setSelection(int position, boolean animate);

Refer below URL: http://groups.google.com/group/android-developers/browse_thread/thread/9140fd6af3061cdf/7f89e53ae53e455b?lnk=gst&q=setselection#7f89e53ae53e455b

Soln: If you're still looking, I have two possible solutions for you, both slightly unpleasant:

(1) You can make the gallery do a fling with a chosen velocity, thus:

myGallery.onFling(null, null, velocity, 0);

By tweaking the velocity, you can set up values to move the selection by one or two in either direction. As the Gallery self-centers, you do not need to get the destination exactly right.

(2) As the Gallery source is available, you can modify it in order to implement your own Gallery. It doesn't look as though you need to add much code to be able to control a fling so as to end at your chosen selection.

I thought I was going to have to do (2), but found I could get away with (1) for my problem.

Samurai