RecyclerView decorator adding extra padding on refresh

后端 未结 8 2302
轻奢々
轻奢々 2021-02-01 17:42

So, I\'m facing a weird problem while implementing RecyclerView in my project. I have a custom decorator to implement a consistent top and bottom padding and a rather different

8条回答
  •  萌比男神i
    2021-02-01 17:51

    You are adding Decoration each time recyclerview is loaded.

    Use one flag instead :

    private boolean flagDecoration = false;
    
    if(!flagDecoration)
    {
        rv.addItemDecoration(new RecyclerViewItemDecoration(30, item_count - 1));
        flagDecoration = true;    
    }
    

提交回复
热议问题