2013-08-18 41 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」 你的代碼。

相關問題