Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width. - Android User Interface

Android examples for User Interface:WebView Zoom

Description

Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width.

Demo Code


//package com.java2s;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class Main {
    /**/*ww  w .  ja  v a 2s . c  om*/
     * Sets whether the WebView loads pages in overview mode, that is,
     * zooms out the content to fit on screen by width.
     *
     * @param webView The webView you wanna enable adapting screen size automatically
     * @return The WebSettings instance
     */
    public static WebSettings adaptScreenSize(WebView webView) {
        WebSettings webViewSettings = webView.getSettings();
        webViewSettings.setLoadWithOverviewMode(true);
        webViewSettings.setUseWideViewPort(true);
        return webViewSettings;
    }
}

Related Tutorials