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. Good luck! Richard On Feb 7, 12:15 am, drasticp <[email protected]> wrote: > I'm trying to set the selection of a Gallery in code. I would like to > have the Gallery smoothly roll down a few items over the duration of a > second or two. At frist glance, it appears that two members would to > the trick: > > Gallery.setAnimationDuration(int animationDurationMillis); > Gallery.setSelection(int position, boolean animate); > > It turns out that the setAnimationDuration only seems to affect the > rubber-bandy "return-to-center" effect of the Gallery. In other words, > when a gallery comes to rest after a fling, and a gallery item is off > center, the animationDurationMillis is used to control the duration of > the Gallery centering up the item. However, the value seems to have no > effect on the setSelection. No matter what value is set with > setAnimationDuration, the Gallery seems to render about 2 or 3 frames > when flying between items 1 and 10 for example. > > Is this working as designed? Does anyone know a trick or workaround > that would let me properly animate setSelection? I'd be especially > grateful if we could do it with an "Ease Out" effect. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

