xBanner轮播

依赖

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
implementation 'com.github.xiaohaibin:XBanner:1.6.1'
    implementation 'com.nineoldandroids:library:2.4.0'

代码

  @Override
    public void getSuccess(Object data) {
        if(data instanceof HomeBannerData){
            final HomeBannerData homeBannerData= (HomeBannerData) data;
            banner.setData(homeBannerData.getResult(),null);
            banner.loadImage(new XBanner.XBannerAdapter() {
                @Override
                public void loadBanner(XBanner banner, Object model, View view, int i) {
                    Glide.with(getApplicationContext()).load(homeBannerData.getResult().get(i).getImageUrl()).into((ImageView) view);
                }
            });


        }

布局


你可能感兴趣的:(xBanner轮播)