Glide.with(getContext()).load(NetUtils.urlString(

thwartData.getBackGroundImage())).into(new SimpleTarget() {

@Override

public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {

rootLayout.setBackgroundDrawable(resource);

}

});

有图片的情况如下:

Glide.with(getContext()).load(NetUtils.urlString(

thwartData.getBackGroundImage())).into(bgImage);]

如果要指定加载后的图片大小, 用另一个构造方法:

/**

  • Constructor for the target that takes the desired dimensions of the decoded and/or transformed resource.

*

  • @param width The width in pixels of the desired resource.

  • @param height The height in pixels of the desired resource.

*/

public SimpleTarget(int width, int height) {

this.width = width;

this.height = height;

}

转载请注明:WebLogic Android 博客 » Glide后台加载图片然后读取bitmap值