dxh 5 vuotta sitten
vanhempi
commit
12e677c0a3

+ 5 - 2
app/src/main/java/com/electric/chargingpile/adapter/LayoutAdapter.java

@ -52,12 +52,15 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
52 52
53 53
    public void setData(ArrayList<TalkRecommendBean> datas) {
54 54
        talkRecommendBeans = datas;
55
        notifyDataSetChanged();
55
        notifyItemRangeChanged(1,talkRecommendBeans.size());
56
//        notifyDataSetChanged();
56 57
    }
57 58
58 59
    public void addData(ArrayList<TalkRecommendBean> datas) {
60
        int size = talkRecommendBeans.size();
59 61
        talkRecommendBeans.addAll(datas);
60
        notifyDataSetChanged();
62
        notifyItemRangeInserted(size,talkRecommendBeans.size());
63
//        notifyDataSetChanged();
61 64
    }
62 65
63 66
    public ArrayList<TalkRecommendBean> getCurrentData() {

+ 2 - 0
app/src/main/java/com/electric/chargingpile/fragment/TalkRecommendFragment.java

@ -88,6 +88,8 @@ public class TalkRecommendFragment extends Fragment implements View.OnClickListe
88 88
        // 设置静默加载模式
89 89
//		xRefreshView1.setSilenceLoadMore();
90 90
        layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
91
        layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE);
92
        recyclerView.setItemAnimator(null);
91 93
        recyclerView.setLayoutManager(layoutManager);
92 94
        // 静默加载模式不能设置footerview
93 95
        recyclerView.setAdapter(layoutAdapter);