java - Fade in image with ViewPropertyAnimator -


i'm trying fade in imageview variable duration using viewpropertyanimator, can't work.

this code use fade out , works great:

final imageview imageview = (imageview)mview.findviewbyid(r.id.image_view); picasso.with(mview.getcontext()).load(mitem.thumbnailurl).into(imageview, new callback() {       @override       public void onsuccess() {            imageview.animate().alpha(0).setduration(duration).start();       }       ... }); 

but if try reverse direction fade in, image never shows up:

final imageview imageview = (imageview)mview.findviewbyid(r.id.image_view); imageview.setalpha(0);  picasso.with(mview.getcontext()).load(mitem.thumbnailurl).into(imageview, new callback() {       @override       public void onsuccess() {            imageview.animate().alpha(1).setduration(duration).start();       }       ... }); 

why alpha value never increase? animation running on different alpha channel setalpha?

change deprecated "setalpha(int alpha)" "setalpha (float alpha)", , work

imageview.setalpha(0f); 

Comments