xml中的WebView标记在Eclipse中显示错误

时间:2014-05-03 14:50:37

标签: android xml eclipse layout webview

为什么布局xml文件拒绝WebView标记。 带有十字的红色圆圈显示在xmlns行中:android =“http://schemas.android.com/apk/res/android” 并且无法启动应用程序。

谢谢

1 个答案:

答案 0 :(得分:0)

我猜您已将xmlns标记放在webview中,如下所示:

<WebView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

将其更改为

<WebView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

xmlns:android标记应该只添加到最外层的布局中。

至于为什么我们使用xmlns:android,请阅读:Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?