我将recyclelerView与LinearLayoutManager一起使用,我需要做这样的事情 (一件超过其他)
答案 0 :(得分:1)
@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();
}
}
答案 1 :(得分:0)
经过一番搜索,我找到了这个解决方案,希望能帮到别人 https://androiddevx.wordpress.com/2014/12/05/recycler-view-pre-cache-views/