Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
3
Indexable
private void DWebView(LinearLayout linLayout, String url) {
        WebView wView = new WebView(getContext);
        WebSettings webSettings = wView.getSettings();
        ((WebSettings) webSettings).setJavaScriptEnabled(true); // Kích hoạt JavaScript nếu cần
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setUseWideViewPort(true);

        // Tùy chỉnh cài đặt cho WebView
        wView.setBackgroundColor(0x00000000); // Đặt màu nền trong suốt (transparent)
        wView.setPadding(0, 5, 0, 5);
        wView.getSettings().setAppCacheEnabled(false);

        // Load URL hoặc nội dung HTML
        if (url.startsWith("http://") || url.startsWith("https://")) {
            // Nếu url là một đường dẫn web
            wView.loadUrl(url);
        } else {
            // Nếu url là nội dung HTML
            wView.loadData(url, "text/html", "utf-8");
        }

        linLayout.addView(wView);
    }

case "DWebView":
                    subFeat++;
                    DWebView(linearLayout, strSplit[1]);
                    break;