Xbanner

 /* xbanner 依赖*/

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

//写一个XbannerBean
在写一个

    XbeannerImgBeanXbeannerImgBean extends SimpleBannerInfo 

//Xbanner显示

  private class setXbanner implements DataCall>> {
      private  Listimg=new ArrayList<>();    
  @Override
public void scuess(final Result> listResult) {   
       if (img.size() == 0) {    
                 for (int i = 0; i < listResult.getResult().size(); i++) {       
                   XbannerImgBean xbannerImgBean = new XbannerImgBean();   
                    xbannerImgBean.imageUrl = listResult.getResult().get(i).getImageUrl();      
                    img.add(xbannerImgBean);    
                }     
         }     
  x_banner.setBannerData(img);
  x_banner.loadImage(new XBanner.XBannerAdapter() {  
         @Override 
   public void loadBanner(XBanner banner, Object model, View view, int position) {       
              Glide.with(getActivity())
              .load(listResult.getResult().get(position).getImageUrl())    
              .diskCacheStrategy(DiskCacheStrategy.ALL) 
              .into((ImageView) view); 
     }   
  });     
   }

你可能感兴趣的:(Xbanner)