Reputation: 19956
Scrollable views such as the ListView have a fade blue effect along the edges where there is no content and scroll to the end. How can I close the effect?
at listview i can use :
setHorizontalFadingEdgeEnabled(false);
android:fadingEdge="none"
android:requiresFadingEdge="none"
but at the viewPager not useful,can give me some advice
Upvotes: 31
Views: 12179
Reputation: 211
Java:
((RecyclerView)viewPager.getChildAt(0)).setOverScrollMode(View.OVER_SCROLL_NEVER);
Upvotes: 2
Reputation: 225
viewPager2.getChildAt(0)?.overScrollMode = RecyclerView.OVER_SCROLL_NEVER
Upvotes: 3
Reputation: 1364
pengwang's answer is good,but it is above android 10.If we use lower version.Try this.
try{
Method method = context.getClass().getMethod("setOverScrollMode",int.class);
Field field = context.getClass().getField("OVER_SCROLL_NEVER");
if(method!=null && field!=null){
method.invoke(viewpager,field.getInt(View.class));
}
}
catch(Exception e){
}
Upvotes: -2