Reputation: 354
I use recyclerView with LinearLayoutManager and I need to do something like this (one items over other)
I think that this can be done by overriding a few methods in LayoutManager, but i don't know which of them.
How i can to do that?
Upvotes: 0
Views: 1730
Reputation: 354
After some searching I found this solution, I hope it will help someone https://androiddevx.wordpress.com/2014/12/05/recycler-view-pre-cache-views/
Upvotes: 0
Reputation: 5741
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
if (mDivider == null) {
return;
}
if (parent.getChildPosition(view) < 1) {
return;
}
if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
outRect.top = mDivider.getIntrinsicHeight();
} else {
outRect.left = mDivider.getIntrinsicWidth();
}
}
Upvotes: 1