Reputation: 171
Is it possible to show scrollbars for scrollable html elements in android's WebView? How to do it?
Upvotes: 8
Views: 20847
Reputation: 57
This works fine in your xml layout:
<WebView
android:id="@+id/myWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarThumbVertical="@color/primary_container_on_primary"
android:scrollbarSize="2dp"/>
Upvotes: 2
Reputation: 9
WebSettings WebSettings12 = browser.getSettings();
WebSettings12.setBuiltInZoomControls(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setScrollbarFadingEnabled(false);
webview.loadUrl("https://google.com");
Upvotes: 0
Reputation: 24181
in your onCreate()
method : try this :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.your_web_view_layout);
browser = (WebView)findViewById(R.id.your_webview);
WebSettings mWebSettings = browser.getSettings();
mWebSettings.setBuiltInZoomControls(true);
browser.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
browser.setScrollbarFadingEnabled(false);
browser.loadUrl("file:///android_asset/index.html");
}
Upvotes: 13