android - How to animate to a specific position of a gallery -


I would like to go to a specific location in a gallery with animation. For example, I have 100 elements in the gallery and the actual Position is 0. I want to slowly move to the animated space 99.

I tried the following command, which seemed promising. But it does not animate: - (

  gallery.setSelection (integer position, boolean animate)  

any signal

Maybe you have to use something like this: create animate.xml file

  & Lt; set xmlns: Android = "http://schemas.android.com/apk/res/android" Android: shareInterpolator = "true" & gt; & lt; translation for Android: fromXDelta = "0% p" Android : ToXDelta = "50% P" // To fix this change range Android: Period = "500" Android: startOffset = "0" />   

and your Code usage in:

  animation inFromRight = AnimationUtils.loadAnimation (this, r.anim.animate); gallery.startAnimation (inFromRight); gallery.setSelection (PicPosition);  < / Pre> 

Thoughts are from this link:


Comments