我知道 Picasso 是一个很棒的图像库。
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
使用此代码我可以将图像加载到图像视图。
但是是否可以使用 Picasso 设置背景资源?
The Javadoc https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso/RequestCreator.java#L276为毕加索的RequestCreator
类有以下示例:
public class ProfileView extends FrameLayout implements Target {
@Override
public void onBitmapLoaded(Bitmap bitmap, LoadedFrom from) {
setBackgroundDrawable(new BitmapDrawable(bitmap));
}
@Override public void onBitmapFailed() {
setBackgroundResource(R.drawable.profile_error);
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)