Recently in playing 3g sports portal client, see this effect: Touch the game icon, there will be an icon to the effect of a large surface. It's kind of interesting. So I made a copy of it.
This is the original artwork:
is actually adding a scaled animation to the icon's touch event, the code is as follows.
Package com.test;
Import android.app.Activity;
Import Android.os.Bundle;
Import android.view.MotionEvent;
Import Android.view.View;
Import Android.view.View.OnTouchListener;
Import android.view.animation.Animation;
Import android.view.animation.ScaleAnimation;
Import Android.widget.Button;
public class Animationbuttonactivity extends activity {@Override public void onCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.main);
Final Button test = (Button) Findviewbyid (R.ID.TEST_BT);
float f1 = 1.0F;
float F2 = 1.3F;
int j = 1;
float F3 = 0.5F; Parameter description://float FromX animation at the beginning of the expansion of the x-coordinate size//float ToX animation at the end of the x-coordinate scaling size//float FromY animation at the start of the y-coordinate scale dimension//flo At the end of the at ToY animation, the scaling dimension on the y-coordinate//int pivotxtype animation at the x axis relative to the object position type//float Pivotxvalue the start position of the x-coordinate of the animation relative to the object//int ype animation in the y-axis relative to the object position type//float Pivotyvalue the start position of the animation relative to the y-coordinate of the object finalImation logoanimation = new Scaleanimation (1.0F, 1.3F, 1.0F, 1.3F, 1, 0.5F, 1, 0.5F);
Set the animation interval logoanimation.setduration (100L); Test.setontouchlistener (New Ontouchlistener () {@Override public boolean ontouch (View V, motionevent
Event) {//Start animation test.startanimation (logoanimation);
return false;
}
}); }
}