如何动画滚动位置?如何平滑滚动? [英] How to animate scroll position? How to scroll smoothly?

查看:164
本文介绍了如何动画滚动位置?如何平滑滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的自定义视图(按钮preSS或事件)平稳地移动到下一个滚动位置。如何实现这一点?首先,我无法看到滚动动画类(仅限α,旋转,缩放和平移)。其次,有动画类,我看不到迭代一(说来滚动什么位置,我们有100个像素的权利)唯一的绝对的人(即从一个恒定值到另一个动画)。

I wish to move smoothly to next scroll position in my custom view (on button press or event). How to implement this? First of all I can't see scroll animation class (only alpha, rotate, scale and translate). Secondly, having animation class, I can't see iterative one (say to scroll 100 pixels rights whatever position we have) only absolute ones (i.e. to animate from one constant value to another).

推荐答案

假设你使用的是滚动型,不smoothScrollTo(...)为你工作?

Assuming you are using a ScrollView, does smoothScrollTo(...) work for you?

<一个href="http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29">http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29

这篇关于如何动画滚动位置?如何平滑滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆