zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Bzoj3555: [Ctsc2014]企鹅QQ
    Bzoj4259: 残缺的字符串
    CF528D Fuzzy Search
    Bzoj2738: 矩阵乘法
    Bzoj3309: DZY Loves Math
    Bzoj4540: [Hnoi2016]序列
    Bzoj2329: [HNOI2011]括号修复
    Bzoj1923: [Sdoi2010]外星千足虫
    Bzoj4004: [JLOI2015]装备购买
    Bzoj1951: [Sdoi2010]古代猪文
  • 原文地址:https://www.cnblogs.com/savagemorgan/p/4011409.html
Copyright © 2011-2022 走看看