Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
364 views
in Technique[技术] by (71.8m points)

How to scroll using custom scrollbars in android 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); 

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...