更新时间:2021-12-28 07:11:48
在回收站视图上设置布局管理器的替代版本.就我而言,我想针对某个特定的子视图进行禁用,例如
Set an overriden version of the layout manager on recycler view. In my case I wanted to disable for when a certain child view was focused e.g.
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context) {
@Override
public boolean requestChildRectangleOnScreen(RecyclerView parent, View child, Rect rect, boolean immediate, boolean focusedChildVisible) {
if (((ViewGroup) child).getFocusedChild() instanceof YourFocusableChildViewClass) {
return false;
}
return super.requestChildRectangleOnScreen(parent, child, rect, immediate, focusedChildVisible);
}
};