To give imageview / button vibrate animation, need to follow these steps.
- create xml file "vibrate_anim.xml" in anim folder
<!--?xml version="1.0" encoding="utf-8"?-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromdegrees="-5"
android:pivotx="50%"
android:pivoty="50%"
android:repeatcount="5"
android:repeatmode="reverse"
</rotate>android:toDegrees="5" />
2.Onclick of Button/Image, give animation to it.
Animation vibrateAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.vibrate_anim);
myImage.startAnimation(shake);
Hope, it will help you.
0 Comment(s)