Patrick Nilexis
Patrick Nilexis

Reputation: 40

Android button press and release animation

I'm trying to make the buttons within my app animate like this:

-Whenever you touch the button (action down) it will scale smaller (from 1.0 to 0.8, for example) and will stay shrank.

-Whenever you release the button, it will go back to its full size and stay like this.

-Only after the two animations occurred, the function of the button will be called.

I've tried using the following method: https://stackoverflow.com/a/19261773/9183824

but it made the animation weird and buggy, the button only shrinks and then goes back to its full size even before I release and without any animation.

I would love to know how to implement an animation like this properly.

Upvotes: 0

Views: 884

Answers (1)

saurabh dhillon
saurabh dhillon

Reputation: 808

Hey in case you are still looking for a solution, use this library i created for the same scenario

implementation 'com.github.saurabhdhillon:anim-press-view:0.0.1'

This is still under development but Button, CardView and ConatinerLayout works fine for the use case you want. Update me if you need some more changes to customise this.

Upvotes: 0

Related Questions