How to set background image to a linearlayout using Android-universal-image-loader? #594

Source: Internet
Author: User

You can do it by 2 ways:

  • Use and loadImage(...) set layout background in listener ( ImageLoadingListener.onLoadingComplete(..., Bitmap loadedImage, ...) )
  • Implement ImageAware which would 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 the This BgViewAware ( new BgViewAware(linearLayout) ) into displayImage(...) method.
    But ViewAware class isn ' t released yet. It'll 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.