Imitation of the effect of the "rubber band" from iOS in the Gallery on Android

I have a Gallery class showing a bunch of images in an Android app, but since only one image is ever displayed at a time, it’s hard for a user to understand when they reached the first or last image in Gallery. Is there a way to mimic the effect of the "rubber band" of iOS, so that the user sees a little empty space when dragging the last image, and they release it, the image returns to the center of the view. Can this be done?

+4
source share
1 answer

Look at the easing equations

http://www.gizma.com/easing/

when you release the screen while dragging the last image, you can use them to smoothly animate the image back to the center of the screen.

As for the effect when dragging the last image, use the multiplication factor at the image position, so the more your finger reaches the side of the screen, the less the image will follow its movement.

+3
source

Source: https://habr.com/ru/post/1332225/


All Articles