Android取消RecyclerView、ListView、ScrollView、HorizontalScrollView滑动到边缘闪现灰白色水波纹动画

标准的Android RecyclerView、ListView、ScrollView、HorizontalScrollView滑动到边缘,会闪现灰白色水波纹动画,以这样大的动画效果提示用户已经滑动到边缘,没法再滑动了。对于这种增强体验是一个很好的设计效果,但是有时候可能不需要这样的效果,取消的方法是在配置RecyclerView、ListView、ScrollView、HorizontalScrollView的xml布局里面,设置:
android:overScrollMode="never"
即可取消。

如果要在上层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;    }
在这里设置相应的mode一样可以。


更多相关文章

  1. ListView的优化就这么多了
  2. Android(安卓)BackgroundViewPager:类似桌面背景壁纸随手指滑动
  3. Android(安卓)之手势识别篇-GestureDetector
  4. 处理固定宽度下的长字符串绘制(Android)
  5. [Android实例] Android(安卓)实现导航菜单左右滑动效果
  6. Android(安卓)实现 WheelView
  7. 滑条自动跳转,显示控件的新条目
  8. android listview 滑动监听
  9. android利用ListView滑动刷新

随机推荐

  1. Android_rom存储,sp存储,sdcard存储
  2. libgdx实例分析小记(一)
  3. android 获取缓存文件的地址
  4. android 批量上传图片
  5. android开发 - NDK_PROJECT_PATH = null
  6. Android打开/关闭免提(SpeakerPhone)
  7. Android实现拖拉移动Item
  8. ubantu10.04配置android 开发环境
  9. 获取drawable里的路径
  10. Android基础教程——调节系统屏幕亮度