Ethanhunt
Ethanhunt

Reputation: 23

Attribute is missing the namespace prefix

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="top">
    <TextViewandroid:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Type here:"/>
<EditText
    android:id="@+id/entry"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/label"/>
<Button
    android:id="@+id/ok"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/entry"
    android:layout_alignParentRight="true"
    android:layout_marginLeft="10dip"
    android:text="OK" />
<Button
    android:layout_alignTop="@id/ok"
    android:text="Cancel"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_toLeftOf="@+id/ok"
    android:layout_below="@+id/entry"/>
</RelativeLayout>

I've just started to learn Android apk programming and I have encountered this problem: "Attribute is missing the namespace prefix". How can I fix this? Please reply.. any reply would be wonderful thanks

Upvotes: 0

Views: 645

Answers (3)

M S Gadag
M S Gadag

Reputation: 2057

u shud give some space after the widget name. replace below code it will work.

<TextView
    android:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Type here:"/>

Upvotes: 0

Miki Franko
Miki Franko

Reputation: 687

change:

TextViewandroid:id="@+id/label"

to:

TextView android:id="@+id/label"

Upvotes: 1

user4272989
user4272989

Reputation:

The problem is with the spacing . try this ..

   <?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"

   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
    android:gravity="top">
   <TextView android:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Type here:"/>
   <EditText
     android:id="@+id/entry"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_below="@id/label"/>
   <Button
     android:id="@+id/ok"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_below="@id/entry"
     android:layout_alignParentRight="true"
     android:layout_marginLeft="10dip"
     android:text="OK" />
   <Button
     android:layout_alignTop="@id/ok"
     android:text="Cancel"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_toLeftOf="@+id/ok"
    android:layout_below="@+id/entry"/>
   </RelativeLayout>

Upvotes: 0

Related Questions