1
webview.setVisibility(View.VISIBLE);
webview.getSettings().setJavaScriptEnabled(true);
//webview.getSettings().setPluginsEnabled(true);
webview.getSettings().setPluginState(PluginState.ON);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setBlockNetworkLoads(false);
webview.setWebChromeClient(new WebChromeClient() {});

final String mimeType = "text/html";
final String encoding = "UTF-8";
String html = getHTML1();
webview.loadDataWithBaseURL("", html, mimeType, encoding, "");
}

public String getHTML1() {
    Log.d("trailer_2 HTML","ok");
    String html = "<iframe class=\"youtube-player\" style=\"border:0;
    width: 100%; height:96%; padding:0px; 
    margin:0px\"id=\"ytplayer\" type=\"text/html\" src=\"http://www.youtube.com/embed/"
            + "H7Ht-m2QMDY"
            + "?fs=0\" frameborder=\"0\">\n"
            + "</iframe>\n";
 return html;
}

我尝试了很多。它适用于平板设备但不适用于移动设备?我也在hardwareAcelator=true清单中提到了 bur 不起作用?

4

0 回答 0