在Android中滚动WebView信用文本 [英] Scrolling webview credit text in android

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

问题描述

我需要在我的应用程序中创建一个积分屏幕.这将是垂直滚动线.这是带有图像的html页面,所以我只能使用webview.滚动将自动执行,并且不允许用户交互.就像电影/连续剧片数从下到上一样.我在资产文件夹中添加了html页面.

I need to make a credits screen in my application. It would be vertically scrolling lines. It is html page with images so I can only use webview. Scrolling is to be performed automatically and no user interaction is allowed. Just like movie/serials credits that goes from bottom to top. I have html page added in assets folder.

如何实现此动画?

推荐答案

由于您使用的是Web视图,因此实际上您可以使用jQuery来完成此操作.

Since you are using a webview, you can actually use jQuery to accomplish this.

$('a[href=#bottom]').click(function(){
    $('html, body').animate({scrollTop:0}, 'slow');
});

通过jQuery动画降低滚动到顶部事件的速度

或者您可以使用处理程序

Or you could use a handler

private Runnable mScrollDown = new Runnable()
{
    public void run()
    {
        WebView webview = (WebView)findViewById(R.id.web_url);
        webview.scrollBy(0, scrollSpeed);
        mHandler.postDelayed(this, 200);
    }
};

这篇关于在Android中滚动WebView信用文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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