Sets whether the WebView loads pages in overview mode - Android android.webkit

Android examples for android.webkit:WebView

Description

Sets whether the WebView loads pages in overview mode

Demo Code

import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class Main{

    /**/*ww w  .j a  v a2  s .  co  m*/
     * 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