如何保持滚动的速度? [英] how to maintain the speed of scroller?

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

问题描述

我有一个问题,而使用滚轮在我的申请。

我已经使用了滚动,但它不能正常工作,因为它不能够保持一致的速度,而自动滚动。文本的速度与时间越来越慢作为文本向上移动。

下面是code,我用于此目的的:

 长度= prompt_text.getLineCount();
Log.d(长度,+长度);
prompt_text.setScroller(滚动);
scroll.startScroll(0,0,0,10 *长度,100000 / speedAmount);


解决方案

你试过设置滚轮插值为LinearInterpolator?
<一href=\"http://developer.android.com/reference/android/widget/Scroller.html#Scroller(android.content.Context,%20android.view.animation.Interpolator\" rel=\"nofollow\">http://developer.android.com/reference/android/widget/Scroller.html#Scroller(android.content.Context,%20android.view.animation.Interpolator)

示例:

 
yourScroller =新的滚轮(yourContext,新LinearInterpolator());

I have a problem while using the scroller in my application.

I have used the scroller but it is not working properly as it is not able to maintain a consistent speed while automatically scrolling. The speed of the text is getting slower with time as the text moves upward.

Here is the code that I used for this purpose:

length = prompt_text.getLineCount();
Log.d("length",""+length);
prompt_text.setScroller(scroll);
scroll.startScroll(0,0,0,10 * length, 100000 / speedAmount);

解决方案

Have you tried setting up the Scroller interpolator as a LinearInterpolator? http://developer.android.com/reference/android/widget/Scroller.html#Scroller(android.content.Context,%20android.view.animation.Interpolator)

Sample:


yourScroller = new Scroller(yourContext, new LinearInterpolator());

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

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