Android Scale Button On Touch


Answer :

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 ;)


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable