使用依赖添加无线轮播加按钮

来源:互联网 发布:ubuntu root中文 编辑:程序博客网 时间:2024/06/05 09:12

//添加依赖

compile 'com.youth.banner:banner:1.4.9'compile 'com.github.bumptech.glide:glide:3.7.0'

//继承ImageLoader 

public class ImageLoaderBanner extends ImageLoader {    @Override    public void displayImage(Context context, Object path, ImageView imageView) {        Glide.with(context).load(path).into(imageView);    }}


//从网络请求的图片路径 是解析后 遍历解析的集合 添加一下代码

banner.setImageLoader(new ImageLoaderBanner());Gson gson=new Gson();MyBean myBean = gson.fromJson(s, MyBean.class);//图片解析list = myBean.getResult().getAdvs();for (MyBean.ResultBean.AdvsBean str:list){    list2.add(str.getPic());    banner.setImages(list2);}banner.start();

原创粉丝点击