zoukankan      html  css  js  c++  java
  • xutils3的使用

    1.添加依赖:compile 'org.xutils:xutils:3.5.0'


    2.清单文件中注册初始化
      初始化:x.Ext.init(this);
             x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.//上线后参数设为false 将debug关掉

    3.使用utils3加载网络图片
       x.image().bind(image, "https://p.ssl.qhimg.com/t01d15b1004b11cb0a7.jpg");

    4.使用utils3加载本地动态图片
      1)创建assets文件 存放动态图片
      2)ImageOptions imageOptions = new ImageOptions.Builder()
                            .setIgnoreGif(false)
                            .setImageScaleType(ImageView.ScaleType.CENTER).build();
                    x.image().bind(image, "assets://d.gif", imageOptions);

    5.使用utils3加载网络数据
      RequestParams requestParams=new RequestParams("http://apicloud.mob.com/v1/cook/category/query?key=1d11949556a24");
                    x.http().get(requestParams, new Callback.CommonCallback<String>() {
                        @Override
                        public void onSuccess(String result) {
                            Log.d("sss","onSuccess::"+result);

                        }

                        @Override
                        public void onError(Throwable ex, boolean isOnCallback) {
                            Log.d("sss","onError::"+ex.getMessage());
                        }

                        @Override
                        public void onCancelled(CancelledException cex) {
                            Log.d("sss","onCancelled::"+cex.getMessage());
                        }

                        @Override
                        public void onFinished() {
                            Log.d("sss","onFinished::");

                        }
                    });
  • 相关阅读:
    多屏共享
    md5-linux_shell
    2017年会所得
    linux无线网络配置_转
    (转)台式机华硕主板双显卡切换,怎么舒服怎么来
    Apache FtpServer 实现文件的上传和下载
    (转载)Windows 上搭建Apache FtpServer
    Eclipse常用设置
    博客园文章样式修改
    黑马公社学习
  • 原文地址:https://www.cnblogs.com/livelihood/p/6758757.html
Copyright © 2011-2022 走看看