Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fillAfter and fillEnabled not working in Android view animation XML

Tags:

I'm curious as to this behavior ... I'm currently setting the two values in the anim XML:

    android:fillEnabled="true"     android:fillAfter="true" 

However, the transformation does not apply after the animation is done ... it always resets. When I set it programmatically via code it does seem to work:

    animation.setFillEnabled(true);     animation.setFillAfter(true); 

So I'm just curious how this should work, as I'd rather set it on the XML. Thanks!

like image 644
Joel Martinez Avatar asked Jun 28 '11 17:06

Joel Martinez


1 Answers

I had the same problem, this worked for me:

<set     android:fillEnabled="true"     android:fillAfter="true"     xmlns:android="http://schemas.android.com/apk/res/android">      <translate         android:fromYDelta="0"         android:toYDelta="-20%p"         android:duration="7000" />  </set> 

Put the attributes fillEnabled and fillAfter in the Set tag.

like image 137
Josh Cole Avatar answered Oct 20 '22 18:10

Josh Cole