Reputation: 19494
I am targeting level 11+
Its easy to to animate the alpha of the entire view by doing something like
view.animate().alpha(0)
But this fades the entire view.
I am interested in fading just the background resource/drawable of a view.
How would I do that?
For now I am doing this:
view.getBackground().setAlpha(0)
But this obviously doesn't animate (fade out) it.
Upvotes: 0
Views: 2186
Reputation: 758
you could use nine old androids (https://github.com/JakeWharton/NineOldAndroids)
ValueAnimator colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", /*Red*/0xFFFF8080, /*Blue*/0xFF8080FF);
colorAnim.setDuration(3000);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.setRepeatCount(ValueAnimator.INFINITE);
colorAnim.setRepeatMode(ValueAnimator.REVERSE);
colorAnim.start();
Upvotes: 1
Reputation: 1219
you could transform your view in a relative layout and set two separate views inside of it, one for the background (with alpha animation) and one for contents
Upvotes: 0