<span id="Label3"></p><p><p>4 animations are available in android:<br>Alphaanimation Transparency Animation effect<br>Scaleanimation Zoom Animation effect<br>Translateanimation Displacement Animation effect<br>Rotateanimation Rotate animation effect<br><br>This section explains Rotateanimation animations,<br>Rotateanimation (float fromdegrees, float todegrees, int pivotxtype, float pivotxvalue, int pivotytype, float Pivotyvalue)<br>Parameter description:<br>Float fromdegrees: The start angle of the Rotation.<br>Float todegrees: the end angle of the Rotation.<br>int pivotxtype:x The scaling mode of the axis, you can take the value of absolute, relative_to_self, Relative_to_parent.<br>The scaling value of the float pivotxvalue:x coordinates.<br>int Pivotytype:y The scaling mode of the axis, you can take the value of absolute, relative_to_self, Relative_to_parent.<br>The scaling value of the float pivotyvalue:y coordinates.<br>Code:</p></p><span style="text-decoration: underline;"><span style="text-decoration: underline;">Copy Code</span></span>The code is as Follows:<br>public class Mainactivity extends Activity {<br>ImageView image;<br>Button start;<br>Button cancel;<br>@Override<br>public void OnCreate (Bundle Savedinstancestate) {<br>Super.oncreate (savedinstancestate);<br>Setcontentview (r.layout.activity_main);<br>Image = (ImageView) Findviewbyid (r.id.main_img);<br>Start = (Button) Findviewbyid (r.id.main_start);<br>Cancel = (Button) Findviewbyid (r.id.main_cancel);<br>/** Set rotation animation */<br>Final rotateanimation animation =new rotateanimation (0f,360f,animation.relative_to_self,<br>0.5f,animation.relative_to_self,0.5f);<br>Animation.setduration (3000);//set Animation duration<br>/** Common Methods */<br>Animation.setrepeatcount (int Repeatcount);//set The number of repetitions<br>Animation.setfillafter (boolean);//whether The animation stays in the finished state after execution<br>Animation.setstartoffset (long startoffset);//wait time before execution<br>Start.setonclicklistener (new Onclicklistener () {<br>public void OnClick (View Arg0) {<br>Image.setanimation (animation);<br>/** Start Animation */<br>Animation.startnow ();<br>}<br>});<br>Cancel.setonclicklistener (new Onclicklistener () {<br>public void OnClick (View V) {<br>/** End Animation */<br>Animation.cancel ();<br>}<br>});<br>}<br>}<p><p><br>Effect:<br></p></p><p><p>Android Animation's rotateanimation Application Detailed</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service