ObjectAnimator
class modifies the attributes of the view, so it updates the property of the view using the setter method of the Object property (as per official Android Guide).
So, when fadein
animation runs, the alpha value is constantly modified, and when fadein.cancel()
executes, the alpha value of the View stops updating. Let's say this value is X
.
So, when you start fadeOut
, it animates from X
to 0.0f
.
Whats the workaround?
For fadeOut
, use two values imply a starting and ending values
fadeOut = Objectanimator.ofFloat(bitmap, "alpha", 1.0f, 0.0f);