shaking / wobble view animation in android shaking / wobble view animation in android android android

shaking / wobble view animation in android


Try setting android:repeatMode="reverse". Below animation gives a very reasonable immitation on my Galaxy Nexus. Obviously you can fine tune the parameters to your own liking.

<?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="infinite"    android:repeatMode="reverse"    android:toDegrees="5" />


Nice shake animation;

res/anim/shake.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">    <translate android:duration="150"        android:fromXDelta="-10%"        android:repeatCount="5"        android:repeatMode="reverse"        android:toXDelta="10%"/></set>

How to use it

final Animation animShake = AnimationUtils.loadAnimation(this, R.anim.shake);btn_done = (Button) findViewById(R.id.btn_act_confirm_done); btn_done.startAnimation(animShake);

How to use it (Simpler version):

btn_done.startAnimation(AnimationUtils.loadAnimation(this,R.anim.shake));


You could try this:

shake.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"            android:fromXDelta="0"            android:toXDelta="10"            android:duration="1000"            android:interpolator="@anim/cycle_7" />

cycle_7.xml

<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"                    android:cycles="7" />