0
I would like to know how to do when the user clicks on the button it gets bigger and smaller when releasing, simulating a zoom effect on the component.
0
I would like to know how to do when the user clicks on the button it gets bigger and smaller when releasing, simulating a zoom effect on the component.
0
Use the onTouchListener event, and by taking Motionevents inside that event you increase/decrease the size.
@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;
}
Browser other questions tagged java android
You are not signed in. Login or sign up in order to post.
Dude.. Can you give me an example with some little snippet of code ?
– Joseph
I edited the answer with the code ;)
– Grupo CDS Informática