Closed YizeLin closed 10 months ago
轮播图有数据正常滚动,但是setOnBannerListener点击没有回调相应 binding.homeBanner.setAdapter(new HomeBannerAdapter(homeBannerEntities)); binding.homeBanner.setOnBannerListener(new OnBannerListener() { @Override public void OnBannerClick(Object data, int position) { if(null!= data){ HomeBannerEntity entity = (HomeBannerEntity) data; if(entity.getIsNeedToken()==1){ String token = UserCenter.getInstance().getToken(); if (StringUtils.isEmpty(token)) { //未登录 startActivity(LoginActivity.class); return; } } Bundle bundle = new Bundle(); Intent intent = new Intent(); if(entity.getContentType()==1){ //跳转到帖子 // bundle.putInt("topicId", Integer.valueOf(entity.get().getTopicId())); // intent.putExtras(bundle); }else{ //跳转到H5页面 if (entity.getH5Title() != null && entity.getH5Url() != null) { bundle.putString("title", entity.getH5Title()); bundle.putString("url", entity.getH5Url()); startActivity(InternalTokenWebActivity.class, bundle); } }
} } });
implementation 'io.github.youth5201314:banner:2.2.2' 引用的事该版本
我也碰到这个问题了,兄弟解决了么?
用这个解决了 #698
轮播图有数据正常滚动,但是setOnBannerListener点击没有回调相应 binding.homeBanner.setAdapter(new HomeBannerAdapter(homeBannerEntities)); binding.homeBanner.setOnBannerListener(new OnBannerListener() { @Override public void OnBannerClick(Object data, int position) { if(null!= data){ HomeBannerEntity entity = (HomeBannerEntity) data; if(entity.getIsNeedToken()==1){ String token = UserCenter.getInstance().getToken(); if (StringUtils.isEmpty(token)) { //未登录 startActivity(LoginActivity.class); return; } } Bundle bundle = new Bundle(); Intent intent = new Intent(); if(entity.getContentType()==1){ //跳转到帖子 // bundle.putInt("topicId", Integer.valueOf(entity.get().getTopicId())); // intent.putExtras(bundle); }else{ //跳转到H5页面 if (entity.getH5Title() != null && entity.getH5Url() != null) { bundle.putString("title", entity.getH5Title()); bundle.putString("url", entity.getH5Url()); startActivity(InternalTokenWebActivity.class, bundle); } }