android.view.InflateException: Binary XML file line #8: Error inflating class android.webkit.WebView?
layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="3dip">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
<!-- 第1个TableLayout,用于描述表中的列属性。第0列可伸展,第1列可收缩 ,第2列被隐藏-->
<TableLayout
android:id="@+id/table1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:collapseColumns="3"
android:padding="3dip"
android:shrinkColumns="1"
android:stretchColumns="0">
<TableRow>
<Button android:text="该列可伸展" />
<Button android:text="该列可收缩" />
<Button android:text="我被隐藏了" />
</TableRow>
<TableRow>
<TextView android:text="我向行方向伸展,我可以很长11111111111111111111 " />
<TextView android:text="我向列方向收缩,我可以很深" />
</TableRow>
</TableLayout>
<!-- 第2个TableLayout,用于描述表中单元格的属性,包括:android:layout_column 及android:layout_span-->
</LinearLayout>
- Acivity
package com.example.fiz.myapphome;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebView;
import com.example.fiz.myapplication.R;
/**
Created by Fiz on 16/4/13.
显示文章详情页面
*/
public class ArticleInfoActivity extends AppCompatActivity {
private WebView webView_home_artilce_info;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_article_info);
// Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_home_article_info);
// toolbar.setTitle("文章详细内容");
// toolbar.setSubtitle("文章详细内容 ");
// toolbar.setBackgroundColor(Color.parseColor("#303F9F"));
// toolbar.setNavigationIcon(R.drawable.ic_left);
//// webView_home_artilce_info = (WebView) findViewById(R.id.webView_home_article_info);
// init();
// toolbar.setNavigationOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// ArticleInfoActivity.this.finish();
// }
// });
webView_home_artilce_info = (WebView) findViewById(R.id.webview);
webView_home_artilce_info.loadUrl("");
}
}
마침내 해결책을 찾았습니다. 프로젝트를 정리하고 다시 컴파일하세요