RecyclerView decorator adding extra padding on refresh

后端 未结 8 2296
轻奢々
轻奢々 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条回答
  •  耶瑟儿~
    2021-02-01 17:48

    I had the same issue and I fixed that with the itemDecorationCount

    if (recyclerView.itemDecorationCount == 0) {
                val itemDecorator = DividerItemDecoration(activity, DividerItemDecoration.VERTICAL)
                itemDecorator.setDrawable(ContextCompat.getDrawable(activity, R.drawable.recycler_divider))
                recyclerView.addItemDecoration(itemDecorator)
            }
    

提交回复
热议问题