frankish
frankish

Reputation: 6846

How to continuouslly fadein and out Button in Android?

I want to fade in and out a Button in my android app when user activates a feature. I saw examples on stackoverflow that shows fading in or out. But is there an easy way to combine in/out animations all together that repeats unlimited amount of time?

Upvotes: 0

Views: 561

Answers (2)

Jani Bela
Jani Bela

Reputation: 1670

I am not 100% sure about your question, but this worked for me as a continue fadeOut and fadeIn animation:

int value = 0;
    for (int i=0;i<100000;i++){
        if (value == 0){
            doFadeOutAnimation();
            value = 1;
        }
        else if (value == 1){
            doFadeInAnimation();
            value = 0;
        }
    }

Upvotes: 1

Ovidiu Latcu
Ovidiu Latcu

Reputation: 72341

Use on your Animation object the following :

myAnimation.setRepeatCount(Animation.INFINITE);
myAnimation.setRepeatMode(Animation.REVERSE);

Upvotes: 2

Related Questions