Android RecyclerView、ScrollView 去除滑动到边缘的阴影效果 - chuwuwang/ReadingNote GitHub Wiki
在Android5.0(以及以后)会出现这样的问题,以下代码设置
android:overScrollMode="never"
去除虚化效果(上下滑动顶部和底部的虚化),以下代码设置
android:fadingEdge="none"
如果要在上层Java代码处理,也是可以,比如在Android官方的RecyclerView实现代码中:
/**
* Set the over-scroll mode for this view. Valid over-scroll modes are
* {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
* (allow over-scrolling only if the view content is larger than the container),
* or {@link #OVER_SCROLL_NEVER}.
*
* Setting the over-scroll mode of a view will have an effect only if the
* view is capable of scrolling.
*
* @param overScrollMode The new over-scroll mode for this view.
*/
public void setOverScrollMode(int overScrollMode) {
if (overScrollMode != OVER_SCROLL_ALWAYS &&
overScrollMode != OVER_SCROLL_IF_CONTENT_SCROLLS &&
overScrollMode != OVER_SCROLL_NEVER) {
throw new IllegalArgumentException("Invalid overscroll mode " + overScrollMode);
}
mOverScrollMode = overScrollMode;
}
setOverScrollMode(View.OVER_SCROLL_NEVER);