XBanner(一屏多显)

1.布局

 


    

 

2.在大Model下:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

3.依赖

   //XBanner
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.github.xiaohaibin:XBanner:1.6.1'

4.主页面

   //网络接口
      iPrenserlpl.getData(Api.sell,HomeBean.class);


//判断
  else  if(data instanceof XBannerBean)
        {
             XBannerBean banner1= (XBannerBean) data;
            xBanner.setData(banner1.getResult(),null);
           xBanner.loadImage(new XBanner.XBannerAdapter() {
               @Override
               public void loadBanner(XBanner banner, Object model, View view, int position) {
                   XBannerBean.ResultBean bean= (XBannerBean.ResultBean) model;
                   Glide.with(getActivity()).load(bean.getImageUrl()).into((ImageView) view);
                   banner.setPageChangeDuration(1000);
               }
           });

 

你可能感兴趣的:(XBanner(一屏多显))