I have set the negative margin for items like this:-
ItemDecoration.java
public class ItemDecorator extends RecyclerView.ItemDecorat
As of 2020 there is new interface ChildDrawingOrderCallback. It defines the order of drawing elements in recycler view. Can be used like so:
class BackwardsDrawingOrderCallback : RecyclerView.ChildDrawingOrderCallback {
override fun onGetChildDrawingOrder(childCount: Int, i: Int) = childCount - i - 1
}
And then
recyclerView.setChildDrawingOrderCallback(BackwardsDrawingOrderCallback())
So there is no need to set neither reverse order nor stack from end anymore.
Try this way and render your recycler view in reverse direction.
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setReverseLayout(true);
layoutManager.setStackFromEnd(true);
recyclerView.setLayoutManager(layoutManager);
Here is the working example GitHub Link
Try overriding this method.
@Override
public int getItemViewType(int position) {
return super.getItemViewType(position);
}