Is there a way to disable fading that a viewPager has scroll to edges?

為{幸葍}努か 提交于 2019-12-18 13:55:08

问题


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


回答1:


I have a solution:

android:overScrollMode="never"

Now everything is OK. I found the solution here.




回答2:


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){

}


来源:https://stackoverflow.com/questions/18716177/is-there-a-way-to-disable-fading-that-a-viewpager-has-scroll-to-edges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!