mr3mo
mr3mo

Reputation: 145

Unexpected namespace prefix "xmlns" found for tag LinearLayout (xmlns:tools ERROR)

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <LinearLayout 
    ***

xmlns:tools="http://schemas.android.com/tools" * This line shows the error Unexpected namespace prefix "xmlns" found for tag LinearLayout, i've tried solutions on stack but didnt get resolved. Please help.

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" 
    android:id="@+id/RL">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world"
        android:id="@+id/label1" />


</LinearLayout>
</ScrollView>

Upvotes: 1

Views: 1488

Answers (1)

Ted Hopp
Ted Hopp

Reputation: 234795

It's complaining about the attribute tools:context=".MainActivity" that is part of the <LinearLayout> tag. It doesn't know what the tools: prefix means.

You need to add xmlns:tools="http://schemas.android.com/tools" as an attribute to the <ScrollView> tag. Alternatively, get rid of the tools:context attribute for the <LinearLayout> tag.

The tools:context (as well as other tools:... attributes) are used as part of Android's lint checking of XML files. See here for more info.

Upvotes: 2

Related Questions