RecyclerView удалить разделитель/декоратор после последнего элементаAndroid

Форум для тех, кто программирует под Android
Anonymous
RecyclerView удалить разделитель/декоратор после последнего элемента

Сообщение Anonymous »


I have a quite simple RecyclerView.
This is how I set the divider:

DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL); itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.news_divider)); recyclerView.addItemDecoration(itemDecorator); And this is drawable/news_divider.xml:

The problem is for some reason the divider is not just created in between the items. But also after the last item. And I want it only in between the items not after every item.

Any idea how to prevent the divider from showing after the last item?


Источник: https://stackoverflow.com/questions/462 ... -last-item

Вернуться в «Android»