2013-08-18 2 views
2

редактор Eclipse, дает «Атрибут отсутствует префикс пространства имен для Android» ошибка для следующего XML:Атрибут отсутствует префикс пространства имен Android для инструментов: контекст

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    tools:context=".MainMenuActivity" > 

ответ

12

Это происходит потому, что xmlns:tools="http://schemas.android.com/tools" отсутствует. Код должен выглядеть следующим образом:

<LinearLayout 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:orientation="vertical" 
    tools:context=".MainMenuActivity" > 
1

добавить xmlns:tools="http://schemas.android.com/tools" в макете

, а также обратите внимание, что должно быть только одно пространство имен для вашего макета и его следует использовать в родительском кириллице!

chanage ваш код

<LinearLayout 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:orientation="vertical" 
    tools:context=".MainMenuActivity" > 
1

Пожалуйста, добавьте Xmlns: инструменты = "http://schemas.android.com/tools" в код.