init Internal Browser WebView - Android User Interface

Android examples for User Interface:WebView

Description

init Internal Browser WebView

Demo Code


//package com.java2s;
import android.app.Activity;

import android.view.Display;

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);//  w w w.  j a va2  s .  c om
        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