XBanner图片轮播

//XBanner图片轮播 依赖

implementation ‘com.github.xiaohaibin:XBanner:1.6.4’
maven { url ‘https://jitpack.io’ }

// bean 必须继承 extends SimpleBannerInfo

xml 文件
     
    
java代码

      // XBanner
         xBanner.loadImage(new XBanner.XBannerAdapter() {
        @Override
        public void loadBanner(XBanner banner, Object model, View view, int position) {
            Ban ban = (Ban) model;
            Glide.with(getActivity()).load(ban.getImageUrl()).into((ImageView) view);}
    }); 
    
    @Override
     public void success(int type,String data) {

    //解析Banner
        BannerBean bannerBean = new Gson().fromJson(data,     BannerBean.class);
        ArrayList result = bannerBean.getResult();
        xBanner.setBannerData(result);


    }

你可能感兴趣的:(XBanner图片轮播)