Unexpected Namespace Prefix "Xmlns" Found for Tag Linearlayout

Unexpected namespace prefix xmlns found for tag LinearLayout

Please try following:

Remove xmlns:android="http://schemas.android.com/apk/res/android from all the places excluding the ScrollView. I believe it is sufficient to inform it to the application once and in the outermost Layout or View of the xml file.

error Unexpected namespace prefix xmlns found for tag LinearLayout

There is no need for placing namespace attribute for every Layout you defined in you layout.xml files. Namespace can be defined for a root level element only as below:

 <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:background="@drawable/wallpaper"
android:layout_height="match_parent" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>
</ScrollView>

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

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.

Unexpected namespace prefix xmlns found for tag ListView

You can remove the
xmlns:android="http://schemas.android.com/apk/res/android"
from your listview definition, it is only necessary once for the xml file.

    <ListView 
android:id="@+id/listview"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

xmlns is the namespace you are defining, in this case you are saying at the beginning of the file that "android" is linked to the namespace at

http://schemas.android.com/apk/res/android

so there is an error when you are attempting to redefine it

Unexpected namespace prefix xmlns for tag fragment

Not sure if I'm helpful here but i only declare the Namespace once in my case in the RelativeLayout

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<fragment class="com.blablabla.MyFragment"
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>

I dont declare the namespace again in the fragment as shown above. As far as I know the Namespace only has te be declared once in the parent ViewGroup

Unexpected namespace prefix app found for tag TextView when I try to set fontFamily attribute

Try changing TextView to android.support.v7.widget.AppCompatTextView.



Related Topics



Leave a reply



Submit