init Internal Browser WebView - Android android.webkit

Android examples for android.webkit:WebView

Description

init Internal Browser WebView

Demo Code

import android.app.Activity;
import android.util.Log;
import android.view.Display;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class Main{

    public static void initInternalBrowser(Activity act, WebView webView) {
        webView.setHorizontalScrollBarEnabled(true);
        webView.setHorizontalScrollbarOverlay(true);
        webView.setVerticalScrollBarEnabled(true);
        webView.setVerticalScrollbarOverlay(true);
        webView.setPadding(0, 0, 0, 0);//  ww w .  j  av a  2s  . c o  m
        webView.setInitialScale(getWebViewScale(act));
    }
    public static int getWebViewScale(Activity act) {
        Display display = act.getWindowManager().getDefaultDisplay();
        int width = display.getWidth();
        Double val = Double.valueOf(width) / Double.valueOf(1000);
        val = val * 100d;
        return val.intValue();
    }

}

Related Tutorials