: Android animation formats I would like to add some animation to an Android application, in which an icon would move from left to right along a horizontal line. Our graphic designer suggested
I would like to add some animation to an Android application, in which an icon would move from left to right along a horizontal line.
Our graphic designer suggested animated GIFs or MOV files, but we're not sure if these are the right formats for Android - especially in terms of file sizes.
Which animation file formats are supported by Android? Is there an official or recommended format by Google?
More posts by @YK2262411
2 Comments
Sorted by latest first Latest Oldest Best
A PNG Sequence is often used in my experience.
Example:
<!-- Animation frames are wheel0.png -- wheel5.png files inside the
res/drawable/ folder -->
<animation-list android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/wheel0" android:duration="50" />
<item android:drawable="@drawable/wheel1" android:duration="50" />
<item android:drawable="@drawable/wheel2" android:duration="50" />
<item android:drawable="@drawable/wheel3" android:duration="50" />
<item android:drawable="@drawable/wheel4" android:duration="50" />
<item android:drawable="@drawable/wheel5" android:duration="50" />
</animation-list>
from: developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html
Most likely this would be done in code using a custom animation. See Android's developer site for more info: Defining Custom Animations. Here, for example, is the code to morph from one shape to another, from AnimatedVectorDrawable:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:duration="3000"
android:propertyName="pathData"
android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z"
android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z"
android:valueType="pathType"/>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.