Closed shiyuankao closed 8 years ago
您好,请问个问题,我在使用XRefreshView上拉加载更多中,设置了默认的上拉加载的View,但显示不出来,请指点下,以下是我的代码: private void bindRecycleView() { this.loadData(); this.xRefreshView.setPullLoadEnable(true); CustomGifHeader header = new CustomGifHeader(this.getActivity()); this.xRefreshView.setCustomHeaderView(header); this.xRefreshView.setPinnedTime(1000); this.xRefreshView.setMoveForHorizontal(true); //this.xRefreshView.setAutoLoadMore(true); this.adapter = new RecyclerAdapter(this.getActivity(), this.listData, R.layout.item_bidding_record) { @Override public void convert(RecyclerViewHolder helper, String item, int position) { RelativeLayout rl_bottom_underway = helper.getView(R.id.rl_bottom_underway); RelativeLayout rl_bottom_announced = helper.getView(R.id.rl_bottom_announced); rl_bottom_underway.setVisibility(View.GONE); rl_bottom_announced.setVisibility(View.GONE); int number = CommonHelper.getRandomNumber(0, 100) % 2; if (number == 0) { rl_bottom_underway.setVisibility(View.VISIBLE); } else { rl_bottom_announced.setVisibility(View.VISIBLE); String winner = MessageFormat.format("获得者:<font color=\"#0171bb\">{0}", "今天要中"); helper.setText(R.id.tv_winner, Html.fromHtml(winner)); String frequency = MessageFormat.format("<font color=\"#f95667\">{0}人次", "8"); helper.setText(R.id.tv_frequency, Html.fromHtml(frequency)); } } }; this.rv_bidding.setHasFixedSize(true); this.rv_bidding.setLayoutManager(new LinearLayoutManager(getActivity())); this.rv_bidding.setAdapter(this.adapter); this.adapter.setCustomLoadMoreView(new XRefreshViewFooter(this.getContext())); }
是在 Fragment 中使用
这个和fragment没有关系,能给个有问题的demo么,你贴的代码我没看出来有什么问题。demo发我邮箱就可以,huxq17@163.com
不要重写getItemCount()方法,用之前最好看下demo中的用法,下个版本我会把getItemCount设为final。
您好,请问个问题,我在使用XRefreshView上拉加载更多中,设置了默认的上拉加载的View,但显示不出来,请指点下,以下是我的代码: private void bindRecycleView() { this.loadData(); this.xRefreshView.setPullLoadEnable(true); CustomGifHeader header = new CustomGifHeader(this.getActivity()); this.xRefreshView.setCustomHeaderView(header); this.xRefreshView.setPinnedTime(1000); this.xRefreshView.setMoveForHorizontal(true); //this.xRefreshView.setAutoLoadMore(true); this.adapter = new RecyclerAdapter(this.getActivity(), this.listData, R.layout.item_bidding_record) {
@Override
public void convert(RecyclerViewHolder helper, String item, int position) {
RelativeLayout rl_bottom_underway = helper.getView(R.id.rl_bottom_underway);
RelativeLayout rl_bottom_announced = helper.getView(R.id.rl_bottom_announced);
rl_bottom_underway.setVisibility(View.GONE);
rl_bottom_announced.setVisibility(View.GONE);
int number = CommonHelper.getRandomNumber(0, 100) % 2;
if (number == 0) {
rl_bottom_underway.setVisibility(View.VISIBLE);
} else {
rl_bottom_announced.setVisibility(View.VISIBLE);
String winner = MessageFormat.format("获得者:<font color=\"#0171bb\">{0}", "今天要中");
helper.setText(R.id.tv_winner, Html.fromHtml(winner));
String frequency = MessageFormat.format("<font color=\"#f95667\">{0}人次", "8");
helper.setText(R.id.tv_frequency, Html.fromHtml(frequency));
}
}
};
this.rv_bidding.setHasFixedSize(true);
this.rv_bidding.setLayoutManager(new LinearLayoutManager(getActivity()));
this.rv_bidding.setAdapter(this.adapter);
this.adapter.setCustomLoadMoreView(new XRefreshViewFooter(this.getContext()));
}