I want gallery images to animate back and forth when a button is clicked. I have used setSelection method but it just scrolls to next and previous items without any animation. Is there any way to achieve this?
Its a bug on the Android Gallery with is Deprecated. I used to simulate a user Fling to achieve animation.
int currentPosition = gal.getSelectedItemPosition();
gallery.setSelection(currentPosition + 1);
gallery.onFling(null, null, (float) (currentPosition + 1) * 1000, 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.