如何在android WebView中使用自定义滚动条滚动? [英] How to scroll using custom scrollbars in android WebView?

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

问题描述

我想在android WebView中使用自定义ScrollBars;并且还想使用该滚动条来滚动 WebView 内容.我知道我们可以使用以下方法显示滚动条:

I want to use custom ScrollBars in android WebView; and also want to use that scrollbar to scroll WebView content. I know that we can show scrollbars using:

mWebView.setVerticalScrollBarEnabled(true);
mWebView.setHorizontalScrollBarEnabled(true); 

但是,如果我使用默认滚动条,则无法通过拖动滚动条来滚动 WebView 的内容.

But if I use thode default scrollbars, then I am not able to scroll the content of WebView by dragging scrollbar.

推荐答案

自定义 WebView 的 Scroll Bar 很容易.只需将此属性代码添加到您自定义的 WebView 的 xml 中即可:

It's easy to custom Scroll Bar of WebView. Just add this attribute code to xml of WebView with your custom:

android:scrollbarThumbVertical="@drawable/your_custom_scrollbar_thumb"
android:scrollbarTrackVertical="@drawable/your_custom_scrollbar_track"

这篇关于如何在android WebView中使用自定义滚动条滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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