[ACCEPTED]-fillAfter and fillEnabled not working in Android view animation XML-animation
Accepted answer
I had the same problem, this worked for 1 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.
It also works if you don't have the set 2 tag and are just doing translate or something 1 like so.
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromXDelta="0"
android:toXDelta="0"
android:fromYDelta="1000"
android:toYDelta="-300"
android:startOffset="100"
android:duration="1000"
android:fillAfter="true" />
In general, use the fillAfter and fillEnabled on the root element
so 1 either
<?xml version="1.0" encoding="utf-8"?>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true"
android:fromXDelta="0%"
android:toXDelta="-100%"
android:duration="500" />
OR
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true">
<translate
android:fromXDelta="0%"
android:toXDelta="-100%"
android:duration="500" />
</set>
putting the fillEnabled and fillAfter attributes 1 in the set tag helped solved the issue.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.