zoukankan      html  css  js  c++  java
  • android ImageLoader 混淆加载drawable出现黑色图片的解决方案

    在网上找了很久,没有找到、后来看了源码才知道。。。

    多线程异步加载和显示图片(图片来源于网络、sd卡、assets文件夹,drawable文件夹(不能加载9patch),新增加载视频缩略图)

    String imageUri = "http://site.com/image.png";      // from Web  
    String imageUri = "file:///mnt/sdcard/image.png";   // from SD card  
    String imageUri = "content://media/external/audio/albumart/13"; // from content provider  
    String imageUri = "assets://image.png";             // from assets  
    String imageUri = "drawable://" + R.drawable.image; // from drawables (only images, non-9patch)  

    使用的时候也很简单,我们只需要给每个图片来源的地方加上Scheme包裹起来(Content provider除外),然后当做图片的url传递到imageLoader中,Universal-Image-Loader框架会根据不同的Scheme获取到输入流

            //图片来源于Content provider
            String contentprividerUrl = "content://media/external/audio/albumart/13";
             
            //图片来源于assets
            String assetsUrl = ImageDownloader.Scheme.ASSETS.wrap("image.png");
             
            //图片来源于
            String drawableUrl = ImageDownloader.Scheme.DRAWABLE.wrap("R.drawable.image");        
    

      

    希望能帮助大家。

  • 相关阅读:
    Array
    ie兼容
    webpack----entry
    webpack——html-webpack-plugin
    webpack 报错 path is not defind
    PHPStorm自动压缩YUI Compressor配置
    fly
    Math.max得到数组中最大值
    简单html弹窗
    js中页面跳转(href)中文参数传输方式
  • 原文地址:https://www.cnblogs.com/kevin-chen/p/5568103.html
Copyright © 2011-2022 走看看