缓慢向上滚动一个 ScrollView [英] Scroll up a ScrollView slowly

查看:25
本文介绍了缓慢向上滚动一个 ScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是我如何非常平稳且缓慢地将 ScrollView 向上滚动到顶部".

The question is "How do i scroll up a ScrollView to top very smoothly and slowly".

在我的特殊情况下,我需要在大约 1-2 秒内滚动到顶部.我试过使用 Handler 手动插值(调用 scrollTo(0, y)),但这根本不起作用.

In my special case i need to scroll to top in about 1-2 seconds. Ive tried interpolating manually using a Handler (calling scrollTo(0, y)) but that didnt work at all.

我已经在一些图书阅读器应用程序上看到了这种效果,所以一定有办法,我确定:D.(文本非常缓慢地向上滚动以继续阅读,而无需触摸屏幕和输入).

I've seen this effect on some bookreader-apps yet, so there must be a way, im sure :D. (Text is very slowly scrolling up to go on reading without touching the screen, doing input).

推荐答案

2秒内将滚动视图移动到2000的位置

In 2 seconds move the scroll view to the possition of 2000

new CountDownTimer(2000, 20) {          

 public void onTick(long millisUntilFinished) {     
   scrollView.scrollTo(0, (int) (2000 - millisUntilFinished)); // from zero to 2000    
 }          

 public void onFinish() {  
 }      

}.start(); 

这篇关于缓慢向上滚动一个 ScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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