Make your Animation
Set your custom animation in view
First of all go to res create anim folder and the create animation reasorce file
in animation dericatory
a blink animation code is:
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="300"
android:repeatMode="restart"
android:repeatCount="0" />
</set>
a bounce animation code is:
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale android:toXScale="1.0"
android:fromYScale="0.0"
android:toYScale="1.0"
android:fromXScale="1.0"
android:duration="1500"/>
</set>
in main activity
val anim= AnimationUtils.loadAnimation(applicationContext,R.anim.blink)
buttonView.startAnimation(anim)
This is useful
ReplyDelete