这个问题已被多次询问,但没有一个答案适合我。 我正在使用webview播放视频网址=“http://youtu.be/gm4wlE04hbI”,网页视图无效并变为空白,它会记录
01-30 00:00:31.640: W/AwContents(16221): nativeOnDraw failed; clearing to background color.
我的布局是
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/layout_base_top_bar" />
<WebView
android:id="@+id/web_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
</WebView>
</LinearLayout>`
代码 webView =(WebView)findViewById(R.id.web_content);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setPluginState(PluginState.ON);
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
L.e(newProgress + "");
}
});
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
});
String url = getIntent().getStringExtra("url");
webView.loadUrl(url);
关闭硬件
android:hardwareAccelerated="false"
我希望有人可以告诉我它有什么问题......