Reputation: 31
I need to make an ImageView shake onClick using only java. I have looked at a couple other similar questions, but those are mainly XML. I a need it only using java.
ImageView
onClick
XML
Upvotes: 3
Views: 267
Reputation: 6287
let's say that mView is the view you want to animate:
mView
ObjectAnimator .ofFloat(mView, "translationX", 0, 25, -25, 25, -25,15, -15, 6, -6, 0) .setDuration(duration) .start();
answer credits Budius