首页 > 代码库 > How to set background image to a LinearLayout using Android-Universal-Image-Loader ? #594
How to set background image to a LinearLayout using Android-Universal-Image-Loader ? #594
You can do it by 2 ways:
- use
loadImage(...)
and set layout background in listener (ImageLoadingListener.onLoadingComplete(..., Bitmap loadedImage, ...)
) - Implement
ImageAware
which will wrapLinearLayout
(likeImageViewAware
). At this moment you can findViewAware
class in repository which does the main work for it. You should just extend it like this: public class BgViewAware extends ViewAware { public BgViewAware(View view) { super(view); } public BgViewAware(View view, boolean checkActualViewSize) { super(view, checkActualViewSize); } @Override protected void setImageDrawableInto(Drawable drawable, View view) { view.setBackgroundDrawable(drawable); } @Override protected void setImageBitmapInto(Bitmap bitmap, View view) { view.setBackgroundDrawable(new BitmapDrawable(view.getResources(), bitmap)); }}
And then you can pass this
BgViewAware
(new BgViewAware(linearLayout)
) intodisplayImage(...)
method.
ButViewAware
class isn‘t released yet. It will be available in UIL 1.9.2.
https://github.com/nostra13/Android-Universal-Image-Loader/issues/594
How to set background image to a LinearLayout using Android-Universal-Image-Loader ? #594
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。