Flavien Haas
Flavien Haas

Reputation: 19

unexpected token with a layout

i'm new here and I and new into android developping too. I Have a problem with a layout that doesn't want to compile. here is my code :

<?xml version="1.0" encoding="utf-8"?>"

</LinearLayout>

<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:layout="http://schemas.android.com/apk/res-auto"
    android:id="@+id/webView"
    layout:width="match_parent"
    layout:height="match_parent" />

</LinearLayout>

the error is at the "LinearLayout" lines it says "unexpected tokens". I have modified this file manually, I have perhaps modified something that have break my file.

Upvotes: 1

Views: 567

Answers (3)

Imran Khan
Imran Khan

Reputation: 13

You have a problem with the opening tags of linear layout. It needs to be look like that.

//Opening tag <LinearLayout     // Closing tag </LinearLayout>

Upvotes: 0

Rishi Prakash
Rishi Prakash

Reputation: 1789

<?xml version="1.0" encoding="utf-8"?>"
<LinearLayout>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:layout="http://schemas.android.com/apk/res-auto"
    android:id="@+id/webView"
    layout:width="match_parent"
    layout:height="match_parent" />

</LinearLayout>

You didn't have proper opening tags. was present instead of in line number 2.

Upvotes: 0

f1sh
f1sh

Reputation: 11944

You have a closing tag in your second line. Make it an opening tag by changing

</LinearLayout>

to

<LinearLayout>

Upvotes: 3

Related Questions