dzwillpower
12/31/2013 - 6:55 AM

异步加载图片 动画渐变出来

异步加载图片 动画渐变出来

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);

			}
		}
	}