Android scale button on touch
Try the following:
@Override
public boolean onTouch(View v, MotionEvent motionEvent) {
int action = motionEvent.getAction();
if (action == MotionEvent.ACTION_DOWN) {
v.animate().scaleXBy(100f).setDuration(5000).start();
v.animate().scaleYBy(100f).setDuration(5000).start();
return true;
} else if (action == MotionEvent.ACTION_UP) {
v.animate().cancel();
v.animate().scaleX(1f).setDuration(1000).start();
v.animate().scaleY(1f).setDuration(1000).start();
return true;
}
return false;
}
This should do the trick ;)