Tuesday, June 21, 2011

[android-developers] Re: AnimationDrawable on ItemizedOverlay

But how do i do this if i haven't any imageview to show the animation?
I have seen this on documentation, but for an overlay is slightly
different...

<!-- Animation frames are wheel0.png -- wheel5.png files inside the
res/drawable/ folder -->
<animation-list android: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>
Here is the code to load and play this animation.

// Load the ImageView that will host the animation and
// set its background to our AnimationDrawable XML resource.
ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
img.setBackgroundResource(R.drawable.spin_animation);

// Get the background, which has been compiled to an
AnimationDrawable object.
AnimationDrawable frameAnimation = (AnimationDrawable)
img.getBackground();

// Start the animation (looped playback by default).
frameAnimation.start()

On 21 jun, 18:21, TreKing <treking...@gmail.com> wrote:
> On Tue, Jun 21, 2011 at 11:15 AM, Felix Garcia Lainez <
>
> fgarcialai...@gmail.com> wrote:
> > Is there any way to show a gif animated or animationdrawable (to do
> > something like MyLocationOverlay) on an ItemizedOverlay? Really i
> > don't see an easy way to do this...
>
> You of course tried setting an AnimationDrawable as the ItemizedOverlay's
> Drawable already ... ?
>
> --------------------------------------------------------------------------- ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment