zoukankan      html  css  js  c++  java
  • image-loader加载图片

    1.添加依赖: compile files('libs/image-loader.jar')


    2.清单文件中注册初始化
      初始化public static void initImageLoader(Context context) {
            // This configuration tuning is custom. You can tune every option, you may tune some of them,
            // or you can create default configuration by
            //  ImageLoaderConfiguration.createDefault(this);
            // method.
            ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
            config.threadPriority(Thread.NORM_PRIORITY - 2);
            config.denyCacheImageMultipleSizesInMemory();
            config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
            config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
            config.tasksProcessingOrder(QueueProcessingType.LIFO);
            config.writeDebugLogs(); // Remove for release app

            // Initialize ImageLoader with configuration.
            ImageLoader.getInstance().init(config.build());
        }

         initImageLoader(this);//onCreate()方法中调用

    3.加载图片
      1)适配器中的使用
      ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleton instance
      imageLoader.displayImage(data.get(position).getImgsrc(),holder.hIcon);
      2)Activity中使用
      ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleton instance
      imageLoader.displayImage("https://p.ssl.qhimg.com/dmsmty/114_114_90/t0179d5643da48ef32c.webp",image);//加载图片
  • 相关阅读:
    http://www.bugku.com:Bugku——SQL注入1(http://103.238.227.13:10087/)
    [笔记]一道C语言面试题:大整数乘法
    [笔记] Access Control Lists (ACL) 学习笔记汇总
    [笔记]如何将传统的回调函数转换为C#5.0支持的await格式
    6.链接与导航
    9章 下拉菜单
    11章圆角框 本章很重要 经常用到
    原来链接与导航
    7竖直排列的导航菜单
    8.水平导航菜单
  • 原文地址:https://www.cnblogs.com/livelihood/p/6758769.html
Copyright © 2011-2022 走看看