滚动视图中创建平滑的信用状滚动 [英] Creating smooth credits-like scrolling in scrollview

查看:160
本文介绍了滚动视图中创建平滑的信用状滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我对Play商店中的应用程序的教程。

So I have a tutorials app on the play store.

在教程的活动我只是有一个的TextView 滚动视图。在的TextView 是巨大的,可能含有向上5000个字符。我想补充一个选项,自动滚动滚动以来这么多揉我的手指生,我想网友也有同样的感觉,因为我得到了有关该功能的一些要求。

In the tutorials activity I simply have a single textview inside a scrollview. The textview is massive and may contain upwards of 5000 characters. I want to add an option to auto scroll since scrolling so much rubs my fingers raw and I think users may also feel the same since I got a few requests about this feature.

再一次,我希望用户点按菜单按钮,点击自动滚屏选项和文本应该开始滚动流畅,不管它是在到了最后。

Once again, I want the user to tap the menu button, click the Auto Scroll option and the text should start scrolling smoothly, from wherever it's at to the end.

我发现这一点:

滚动型自动滚动

public void scrollRight(final ScrollView h){
  new CountDownTimer(10000, 25) { 
     public void onTick(long millisUntilFinished) { 
        h.scrollBy(1,0);
     }
     public void onFinish() { 

     } 
  }.start();
}

但我有这几个疑点。这会保持用户界面的反应?我的意思是即使是自动滚动我希望用户能够通过零时到向上或向下移动所有他们想要的,而的它仍然是自动滚动。

此外,这可能是在某些设备上有点风声鹤唳,如何使滚动顺畅?

Further this might be a bit jittery on some devices, how do I make the scrolling smooth?

以上运行十秒钟,但我需要它无限期地运行。有没有一种方法,我可以计算滚动所需的最长时间?或者干脆使用了大量的工作会同样?说百万毫秒?

Above it runs for ten seconds, but I need it to run indefinitely. Is there a way I can calculate the max time needed to scroll? Or simply using a large number will work equally well? Say 1 million milliseconds?

最后,我让用户设置的滚动速度。但我认为,这将是很容易,一旦我得到基本的自动滚动权利。

Eventually I'd let the user set the scroll speed. But I reckon that will be easy once I get the basic auto scrolling right.

推荐答案

这是非常相似的东西,我已经试过,但我已经有一个处理程序(可以,只要你想运行)做到了。

This is very similar to something I've tried, yet I've done it with a handler (which can run for as long as you wish).

原来的职位,我写的<一个href=\"http://stackoverflow.com/questions/18697619/auto-scrolling-of-adapterview-listview-gridview\">here.

The original post i've written is here.

有关允许用户交互,可以暂时禁用自动滚动当用户触摸它,并重新启用它的用户已经停止后(也许用setOnTouchListener)。

about allowing the user to interact, you can temporary disable the auto-scrolling when the user touches it, and re-enable it after the user has stopped (maybe use setOnTouchListener).

这篇关于滚动视图中创建平滑的信用状滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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