0
How do I make animation in an imageview with the XML animation file?
0
How do I make animation in an imageview with the XML animation file?
3
You need to start seeing this: View Animation
Here’s an example of how we can make a Blink Animation
. That’s the kind of excitement that gets blinking to view.
Blink.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="700"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toAlpha="1.0" />
</set>
All these tags (Duration, fromAlpha, interporlator, ...) are explained in the link I sent to you.
But in addition, the main tags for this kind of animation are these: Duration, fromAlpha, toAlpha.
Duration: sets the time the animation will update, i.e., the larger, slower the effect will be performed.
fromAlpha: is responsible for making the view invisible.
toAlpha: it will clear the view.
To apply animation to any view, do this:
yourImageView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.blink)).
To pause the animation in progress, do this:
yourImageView.clearAnimation();
You can find more examples of animations on: API Demos
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.