• 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一样可以。

    转载自:https://yq.aliyun.com/articles/615673

  • 相关阅读:
    优秀网站推荐
    本机号码一键登录
    基金配置#通过且慢分析基金相关性
    开源didi kafka-manager使用
    多线程编程解决思路
    jsoup选择器
    codeman的角色权限显隐
    html页面跳转带中文参数,乱码
    idea代码查看当前项目占用内存
    阿里云oss上传———通过MultipartFile,springmvc模式
  • 原文地址:https://www.cnblogs.com/Im-Victor/p/12737628.html
Copyright © 2020-2023  润新知