Since API 24, the RecyclerView
will auto scroll to a item which is displayed in partial by the user click the item.
How to disable this feature?
The codes below works before support-library 25.0.1
.
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate) {
Object tag = child.getTag();
if( tag != null && tag.toString().equalsIgnoreCase("preventAutoScroll") ){
return false;
}
return super.requestChildRectangleOnScreen(child, rect, immediate);
}
It has to be focusable and clickable, because it's a TextView
and the text needs to be selectable.