Created
December 31, 2013 06:55
-
-
Save dzwillpower/8193499 to your computer and use it in GitHub Desktop.
异步加载图片 动画渐变出来
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AlphaImageFetchTask extends BaseImageFetchTask { | |
public AlphaImageFetchTask(String url, int targetWidth, int targetHeight) { | |
super(url, targetWidth, targetHeight); | |
} | |
public AlphaImageFetchTask(String url, int targetWidth, int targetHeight, String key) { | |
super(url, targetWidth, targetHeight, key); | |
} | |
@Override | |
public void setDrawable(View view, Drawable drawable) { | |
if(drawable instanceof AsyncDrawable){ | |
super.setDrawable(view, drawable); | |
}else{ | |
Drawable[] drawables=new Drawable[2]; | |
drawables[0]=new ColorDrawable(0); | |
drawables[1]=drawable; | |
TransitionDrawable td=new TransitionDrawable(drawables); | |
td.startTransition(300); | |
super.setDrawable(view, td); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment