Android 应用程序中的平滑滚动
我想将平滑滚动功能添加到我的应用程序中。 即我有一个巨大的文本,我想自动滚动它(就像在图书阅读器中一样)。
谁能提供平滑滚动的任何示例?
I would like to add the smooth scrolling functionality into my application.
i.e. I have a huge text and I want to scroll it automatically (like in book readers).
Could anyone offer any examples of smooth scrolling?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需将要滚动的视图放入 ScrollView 中即可。因此,要将一些文本放入滚动区域,请将文本放入 TextView 中,然后将 TextView 放入 ScrollView 中,如下所示:
Just put the view(s) you want to scroll inside a ScrollView. So to put some text in a scrolling area, put the text in a TextView, and then the TextView inside a ScrollView, like this:
使用反射更新ScrollView的Scroller:
使用smoothScrollTo方法(可能必须setSmoothScrolligEnabled(true))
Use reflection to update the ScrollView's Scroller:
Use smoothScrollTo method (may have to setSmoothScrolligEnabled(true))