Widget - FAB Image Animation

final int[] ids = {R.drawable.icon1,R.drawable.icon2,R.drawable.icon3};

valueAnimator = android.animation.ValueAnimator.ofInt(0, ids.length - 1).setDuration(1000);
valueAnimator.setInterpolator(new LinearInterpolator());


valueAnimator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener() {
        int i = -1;
        @Override
        public void onAnimationUpdate(android.animation.ValueAnimator animation) {
            int animatedValue = (int) animation.getAnimatedValue();
            if(i!=animatedValue) {
                _fab.setImageDrawable(getResources().getDrawable(ids[animatedValue]));
                i = animatedValue;
            }
        }
    });

}
private android.animation.ValueAnimator valueAnimator;
public void nothing() {

//Use it on Button to reverse animator

valueAnimator.reverse();

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to find and​ highlight a word in a text field in Sketchware?

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation