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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

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