• 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 wrap LinearLayout (like ImageViewAware). At this moment you can find ViewAware 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)) into displayImage(...) method.
      But ViewAware class isn't released yet. It will be available in UIL 1.9.2.

    https://github.com/nostra13/Android-Universal-Image-Loader/issues/594

  • 相关阅读:
    动手动脑(类与对象作业再次提交)
    论团队(类与对象邮箱作业再次提交)
    流于形式的沟通
    加密
    string类中一些方法的使用
    StringEquals的用法
    命令行接收数字求和
    计算机思维
    SpringBoot之Callable处理异步请求
    MySQL8.0 zip版本 安装
  • 原文地址:https://www.cnblogs.com/savagemorgan/p/4011409.html
Copyright © 2020-2023  润新知