Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Scale Animation with bounce interpolator

I am doing a scale animation with anim xml as follows. The animation interpolator isn't working. I am trying to have bounce interpolator but isn't working.

    <?xml version="1.0" encoding="utf-8"?>     <set xmlns:android="http://schemas.android.com/apk/res/android" >      <scale         android:duration="900"         android:fromXScale="1"         android:fromYScale="0.5"         android:interpolator="@android:anim/bounce_interpolator"         android:pivotX="50%"         android:pivotY="0%"         android:toXScale="1.0"         android:toYScale="1.0" />      </set> 

EDIT: Actually my whole xml is

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" >  <scale     android:duration="600"     android:fromXScale="1"     android:fromYScale="0.5"     android:interpolator="@android:anim/bounce_interpolator"     android:pivotX="50%"     android:pivotY="0%"     android:toXScale="1.0"     android:toYScale="1.0" />  <alpha     android:duration="@android:integer/config_longAnimTime"     android:fromAlpha="0.0"     android:interpolator="@android:anim/decelerate_interpolator"     android:toAlpha="1.0" />  </set> 
like image 540
Gaurav Vashisth Avatar asked Jan 01 '13 12:01

Gaurav Vashisth


1 Answers

Finally got the solution. It works for me and could be helpful to others. The key was to put the android:interpolator tag in the animation set.

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/bounce_interpolator" >  <scale     android:duration="600"     android:fromXScale="1"     android:fromYScale="0.5"     android:pivotX="50%"     android:pivotY="0%"     android:toXScale="1.0"     android:toYScale="1.0" />  <alpha     android:duration="600"     android:fromAlpha="0.0"     android:toAlpha="1.0" />  </set> 
like image 96
Gaurav Vashisth Avatar answered Oct 08 '22 16:10

Gaurav Vashisth