Android official documentation has a lot of articles and experiences on Developing interface special effects. The reason why I wrote this animated effect code is that I found that many articles use XML resources to deploy various effects, if the effect changes dynamically, for example, if the position of the image I clicked is changed, it needs to fly to a specified position. The Code is as follows:
Mgridview. setonitemclicklistener (New onitemclicklistener () {<br/> @ override <br/> Public void onitemclick (adapterview <?> Arg0, view arg1, int arg2, <br/> long arg3) {<br/> animationset set = new animationset (true ); <br/> scaleanimation scaleanim = new scaleanimation (1.0f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f); <br/> set. addanimation (scaleanim); <br/> int left = arg1.getleft (); <br/> int Top = arg1.gettop (); <br/> int Bottom = arg1.getbottom (); <br/> int right = arg1.getright (); <br/> int width = arg1.getwidth (); <br/> int Height = arg1.getheight (); <br/> translateanimation trananim = new translateanimation (<br/> animation. absolute, <br/> arg1.getleft (), animation. absolute, 0, <br/> animation. absolute, arg1.gettop (), <br/> animation. absolute, 512); <br/> set. addanimation (trananim); <br/> set. setinterpolator (selectinterpolator); <br/> set. setduration (800); <br/> arg1.startanimation (SET); <br/>}< br/> });