Reputation: 7071
I am displaying number of icon on map, now i want those icon should blink, please guide me how to that. can we use two image for light and dim, but main problem is that how to change that overlay image or how to put animation on that image to blink.
Thanks in advance.
Upvotes: 1
Views: 2017
Reputation: 13815
You have to make a custom view and use it as a Map Overlay.
Tell Its OnDraw() to invallidate whole view after 500ms and everytime drawing again use alternative image.
This link might be helpful to you:
Upvotes: 0
Reputation: 2158
if you are using ImageView for icon then put below xml in drawable and use as a Imageview src.
<animation-list android:id="@+id/my_animation" android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/image1" android:duration="150" />
<item android:drawable="@drawable/image2" android:duration="150" />
</animation-list>
and use below code to set animation
ImageView img = (ImageView)findViewById(R.id.imageView);
AnimationDrawable frameAnimation = (AnimationDrawable)img.getDrawable();
frameAnimation.setCallback(img);
frameAnimation.setVisible(true, true);
frameAnimation.start();
Upvotes: 2