Recently, when I was playing the 3G sports portal client, I saw the following effect: by clicking the event icon, there will be a larger icon ., very interesting. so I made a copy of it.
This is the source image:
In fact, a scaling animation is added to the icon 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: // scaling size on X coordinate at the start of Float fromx animation // scaling size on X coordinate at the end of Float tox animation // scaling size on Y coordinate at the start of Float fromy animation/ /scaling size on Y coordinate at the end of Float toy animation // the start position of the int ready txtype animation on the X axis relative to the object position type/float ready txvalue animation relative to the X coordinate of the object // int ready tytype animation in Y axis relative to object position type // float ready tyvalue animation relative to object y coordinate start position final animation 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 () {@ overridepublic Boolean ontouch (view V, motionevent event) {// start the animation test. startanimation (logoanimation); Return false ;}});}}