下拉刷新 广告banner 下面指示器成倍增加如何破啊
daiwenbing opened this issue · 10 comments
你好,麻烦你把下拉之后的数据填充写上来,我看一下
public void inittopPager(){
//配置pagerbean,这里主要是为了viewpager的指示器的作用,注意记得写上泛型
PageBean beans = new PageBean.Builder<BannerListModel.data>()
.setDataObjects(bannerlist)
.setIndicator(viewHolderHead.bottomScaleLayout)
.builder();
// 设置viewpager的动画,这里提供了三种,分别是MzTransformer,ZoomOutPageTransformer,
// 和DepthPageTransformer,可以体验一下
// viewHolderHead.loopViewpager.setPageTransformer(false,new MzTransformer());
//
viewHolderHead.loopViewpager.setPageListener(beans, R.layout.image_layout, new PageHelperListener() {
@OverRide
public void getItemView(View view, final Object data) {
ImageView imageView = (ImageView) view.findViewById(R.id.page_icon);
final BannerListModel.data bean = (BannerListModel.data) data;
Glide.with(getActivity())
.load(bean.getPic())
.placeholder(R.mipmap.loag_station_banner)
.into(imageView);
imageView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
toppager_click(bean);
}
});
}
});
}
你的beans在下拉之后,是不是没清除?
beans不是没次new的吗 没次刷新调用 inittopPager() 数据长度不变 没找到哪里问题
晚上下班我写个demo看一下,或者你把你的demo发一下我,845731923@qq.com
好的 我在正式项目上弄 想换成你这个 之前弄的没有刷新
` //轮播banner
GsonRequest request_banner = new GsonRequest(Request.Method.POST, DSLConnections.GETBANNERLIST, BannerListModel.class, null,
new Response.Listener() {
@OverRide
public void onResponse(BannerListModel model) {
bannerListModel = model;
return_banner();
}
}, new Response.ErrorListener() {
@OverRide
public void onErrorResponse(VolleyError arg0) {
// Toast.makeText(getActivity(), VolleyErrorHelper.getMessage(arg0,getActivity()),Toast.LENGTH_SHORT).show();
}
});
request_banner.setTag("tag");
DSLApplication.getHttpQueue().add(request_banner);
/**
* 广告 banner viewpager
*/
public void return_banner() {
try {
if ("0000".equals(bannerListModel.getErrorCode())) {
bannerlist.clear();
bannerlist.addAll(bannerListModel.getData());
inittopPager();
}
} catch (NullPointerException e) {
}
}`
老哥 在PageBean之前做下判断就好了
if (viewHolderHead.bottomScaleLayout!=null){
viewHolderHead.bottomScaleLayout.removeAllViews();
}
PageBean beans = new PageBean.Builder<BannerListModel.data>()
.setDataObjects(bannerlist)
.setIndicator(viewHolderHead.bottomScaleLayout)
.builder();
666
感谢反馈