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

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

Create Stopwatch App in Android using Sketchware

Codes for modifying Action Bar in Sketchware

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

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

How to integrate Admob Ads in Sketchware project using AIDE?

Firebase Login/Register with email verification