I am new to Android Animation and want to do a basic animation
Rotate a view by 180deg
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:fromDegrees="0"
android:toDegrees="180"
android:pivotX="50%"
android:pivotY="50%"
android:duration="300"
android:fillAfter="true"
android:fillEnabled="true"
/>
but the problem is after animation is done the view returns to its original position i want the view to be 180deg rotated after animation is done
I also added a AnimationListener with onAnimationEnd to do it but it gives some glitch
android.view.animation.RotateAnimation. An animation that controls the rotation of an object. This rotation takes place in the X-Y plane. You can specify the point to use for the center of the rotation, where (0,0) is the top left point. If not specified, (0,0) is the default rotation point.
rotate); objectImg. startAnimation(myAnim); When a button is pressed, the rotation must stop. Hence in my onClick(), I called clearAnimation().
hey use this ....
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true">
<rotate
android:duration="1000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="180" />
</set>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With