RecyclerView item decoration

I have a RecyclerView with a GridLayoutManager.

I installed custom ItemDecoration:

public class ListDetailsItemDecoration extends RecyclerView.ItemDecoration { private int space; public ListDetailsItemDecoration(int space) { this.space = space; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int itemPosition = parent.getChildPosition(view); outRect.left = space; outRect.right = space; outRect.bottom = space; if(itemPosition == 0 || itemPosition == 1) { outRect.top = space; } if(itemPosition % 2 == 0) { outRect.right = space / 2; } else { outRect.left = space / 2; } } } 

It works fine until I need to remove someone.

 notifyItemRemoved(position); 

The grid does not change.

Any ideas?

+7
android android-recyclerview
source share

No one has answered this question yet.

See related questions:

877
Why doesn't RecyclerView have onItemClickListener ()?
868
How to add separators and spaces between elements in RecyclerView?
782
How to create a RecyclerView with multiple view types?
511
RecyclerView onClick
231
Getting visible items in a RecyclerView
4
RecyclerView animation animation modes do not work (APPEARANCE)
0
Saving ToggleButton state in ListView using SharedPreferences
0
How to add a child element (Product) to a child element (Store) in a Firebase database using RecyclerView PLEASE
0
Recycler's nested view is laggy when scrolling for the first time

All Articles