WongSolo
WongSolo

Reputation: 41

WebView reset zoom setting

I set WebView with this initial values

    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setLoadWithOverviewMode(true);
    webview.getSettings().setUseWideViewPort(true);

After the first loading, the web page shows as full page. If I load a new Url the new page shows with the last zoom settings. It is not loaded with the initial setting. How can I reset the last zoom settings to initial value before loading the next url?

Upvotes: 4

Views: 2974

Answers (3)

arlomedia
arlomedia

Reputation: 9061

In my app, testing on Android 8, I tried all the combinations of the previous answers. setInitialScale made no difference and only this reset the zoom level before a new load:

webView.getSettings().setLoadWithOverviewMode(false);
webView.getSettings().setLoadWithOverviewMode(true);

Upvotes: 0

Jéwôm'
Jéwôm'

Reputation: 3971

In Kotlin you wan try :

webview.settings.loadWithOverviewMode = true
webview.setInitialScale(0)

Upvotes: 0

Ravi
Ravi

Reputation: 2367

try to set these properties- webview.getSettings().setLoadWithOverviewMode(true); webview.setInitialScale(0);

Upvotes: 5

Related Questions