Mobile app version of vmapp.org
Login or Join
YK2262411

: 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

@YK2262411

Posted in: #Android #Animation

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @YK2262411

2 Comments

Sorted by latest first Latest Oldest Best

 

@Marchetta832

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

10% popularity Vote Up Vote Down


 

@Sue6373160

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"/>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme