Andrei Pascale
Andrei Pascale

Reputation: 232

Animations don't work

I don't know what's happening, but most of my animations don't work. For example:

nothingToShow.animate().alpha(1f).setDuration(android.R.integer.config_shortAnimTime).setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationStart(Animator animation) {
        nothingToShow.setAlpha(0f);
        nothingToShow.setVisibility(View.VISIBLE);
        super.onAnimationStart(animation);
    }
});

deleteAll.animate().alpha(0f).setDuration(android.R.integer.config_shortAnimTime).setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        deleteAll.setVisibility(View.GONE);
        super.onAnimationEnd(animation);
    }
});

searchImg.animate().alpha(0f).setDuration(android.R.integer.config_shortAnimTime).setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        searchImg.setVisibility(View.GONE);
        super.onAnimationEnd(animation);
    }
});

nothingToShow appears, but the other two Views don't dissapear. Most of the animations which aren't working are from alpha 1f to 0f, but not all of them. Some are working. That is very strange. Any idea?

Upvotes: 0

Views: 132

Answers (1)

ephemient
ephemient

Reputation: 204678

.setDuration() takes a time in milliseconds, not a resource ID (docs)

getResources().getInteger(android.R.integer.config_shortAnimTime)

Upvotes: 2

Related Questions