ClassCastException:android.view.View can not be cast to android.view.ViewGroup
在layout中用XML布局时切换到layout视图查看效果时,报ClassCastException: android.widget.ImageView can not be cast to android.view.ViewGroup,但在XML代码编辑视图中并没有错误提示,XML代码如下:
<?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">
<ImageView android:id="@+id/top" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/top">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:stretchColumns="3,5">
<TableRow>
<ImageButton android:id="@+id/arrowleft"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/arrowleft" android:layout_column="0">
</ImageButton>
</TableRow>
</TableLayout>
</LinearLayout>
</ImageView>
<WebView android:id="@+id/webView" android:visibility="visible"
android:layout_width="fill_parent" android:layout_height="fill_parent"></WebView>
<ImageButton android:id="@+id/bottom" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/bottom">
</ImageButton>
</LinearLayout>