简体   繁体   中英

Android-Change scroll animation as acceleration deceleration

I have listView implemented. When I scroll programmatically, it scrolling animation is very fast. I want the scroll animation to accelerate and then decelerate with a Maximum velocity (and/or duration) provided by me.

You can use this library: https://github.com/daimajia/AnimationEasingFunctions

For example:

    AnimatorSet animation = new AnimatorSet();
    animation.playTogether(Glider.glide(Skill.CubicEaseInOut, 500f, ObjectAnimator.ofInt(listView, "scrollY", itemView.getTop())));
    animation.setDuration(500);
    animation.start();

where Skill.CubicEaseInOut is type of animation acording http://easings.net/

I hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM