如何在android WebView中使用自定义滚动条滚动?

编程入门 行业动态 更新时间:2024-10-24 23:28:57
本文介绍了如何在android WebView中使用自定义滚动条滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想在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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 00:42:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1031267.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   滚动条   如何在   WebView   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!