Monday, April 29, 2013

Button Animation android



Button Animation android
create folder anim in res folder
then create xml file name anim_rotate.xml

paste this to anim_rotate.xml

<?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="500"
android:startOffset="0"
android:repeatCount="1"
android:repeatMode="reverse" />
</set>


now declare this in Activity

final Animation animRotate = AnimationUtils.loadAnimation(this, R.anim.anim_rotate);

Button b1 = (Button)findViewById(R.id.button);
b1.startAnimation(animRotate);

No comments:

Post a Comment