ݺߣ

ݺߣShare a Scribd company logo
Android
RotateAnimation
http://developer.android.com/intl/zh-tw/reference/android/view/animation/RotateAnimation.html
2
RotateAnimation
new RotateAnimation res/anim/ XML
3
new RotateAnimation
4
new RotateAnimation
Animation animation = new RotateAnimation(
0.0f, 270.0f,
Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 1.0f
);
?
animation.setDuration(2000);?
animation.setFillAfter(true);
5
res/anim/ XML
Animation animation = AnimationUtils.loadAnimation(
this, R.anim.my_animation
);
<?xml version="1.0" encoding="utf-8"?>?
<set xmlns:android="http://schemas.android.com/apk/res/android"?
android:interpolator="@android:anim/linear_interpolator">?
<rotate?
android:fromDegrees="0"?
android:toDegrees="360"?
android:pivotX="50%"?
android:pivotY="50%"?
android:duration="2000"?
android:repeatCount="-1"?
android:startOffset="0"/>?
</set>
my_animation.xml
6
XML Attributes
Attribute Name Related Method Description
android:detachWallpaper setDetachWallpaper(boolean) Window wallpaper
android:duration setDuration(long) ( )
android:fillAfter setFillAfter(boolean)
android:fillBefore setFillBefore(boolean) ( AnimationSet)
android:fillEnabled setFillEnabled(boolean) true: ?llBefore , false: ?llBefore
android:interpolator setInterpolator(Interpolator)
android:repeatCount setRepeatCount(int) (0~N, -1: )
android:repeatMode setRepeatMode(int) (RESTART, REVERSE)
android:startOffset setStartOffset(long) ( )
android:zAdjustment setZAdjustment(int) Z
http://developer.android.com/intl/zh-tw/reference/android/view/animation/RotateAnimation.html#inhattrs
7
Sample Code
https://github.com/ccc-larc/TryAndroidRotateAnimation
8

More Related Content

Android RotateAnimation