0
votes

why is layout xml file rejecting WebView tag. Red circle with cross is displayed in line xmlns:android="http://schemas.android.com/apk/res/android" and application can not be started.

Thank you

1
If you hover over the red cross it'll display the error. Can you tell us what it is ? - Shivam Verma
it says:Unexpected namespace prefix "xmlns" found for tag WebView - user3599319

1 Answers

0
votes

I am guessing you've put the xmlns tag in the webview, something like this:

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

Change it to

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

The xmlns:android tag should only be added to the outermost layout.

As to why we use xmlns:android, Read : Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?