yakobom
yakobom

Reputation: 2711

Scrollable and zoomable view with webviews

Let me start by saying - I know there are quite a lot of posts on this issue. I've been digging and testing it quite a bit, but couldn't come up with the proper solution to my specific requirements.

I need to have a master view with several webviews inside it, and more than one should be visible at a single moment. For this master view - I need to be able to scroll it (to reveal invisible webviews) and to zoom (in order to focus on a single webview).

I've tried TableLayout, but had problems with the zoom (and painting issues with the scrolling). I've tried scroll views, but also read it's not recommended.

Any ideas or recommendation regarding how to achieve this?

Thanks, yakobom

Upvotes: 0

Views: 342

Answers (3)

Mohammed Saleem
Mohammed Saleem

Reputation: 578

to scrolling webview:

 mWebView2.getSettings().setJavaScriptEnabled(true);
 mWebView2.getSettings().setLoadWithOverviewMode(true);
 mWebView2.getSettings().setUseWideViewPort(true);
 mWebView2.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
 mWebView2.setScrollbarFadingEnabled(true);

to zooming webview:

webView.setInitialScale(50);
webPlanSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
webPlanSettings.setUseWideViewPort(true);

Upvotes: 0

Painless
Painless

Reputation: 176

A simple approach could be to have only one webview with the root html doc containing multiple iframes. Load each page in one of the iframes.

This way the scrolling/zooming could be handled by the webview itself.

Upvotes: 1

Adi
Adi

Reputation: 13

Scrollable view can be achieved by adding a scroll view in .xml file and placing remaining text views, edit texts in that scroll view..

Upvotes: 0

Related Questions