huaxunhuang
10/21/2017 - 7:03 AM

Anki Android #02

/** Determine if the device is running API level 11 or higher. */
    public static boolean isHoneycomb() {
        return getSdkVersion() >= Build.VERSION_CODES.HONEYCOMB;
    }
    
    /** Get the current Android API level. */
    public static int getSdkVersion() {
        return Build.VERSION.SDK_INT;
    }
 @SuppressLint({"NewApi", "SetJavaScriptEnabled"})
    // because of setDisplayZoomControls.
    private WebView createWebView() {
        WebView webView = new MyWebView(this);
        webView.setWillNotCacheDrawing(true);
        webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
        if (CompatHelper.isHoneycomb()) {
            // Disable the on-screen zoom buttons for API > 11
            webView.getSettings().setDisplayZoomControls(false);
        }