Android 在Eclipse中解析XML时出现未绑定前缀错误

Android 在Eclipse中解析XML时出现未绑定前缀错误,android,xml,android-layout,layout,toolbar,Android,Xml,Android Layout,Layout,Toolbar,我想将工具栏小部件添加到我的应用程序中。所以,当我将xml代码添加到布局文件时,出现了未绑定前缀错误。我该怎么解决这个问题 My layout.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

我想将工具栏小部件添加到我的应用程序中。所以,当我将xml代码添加到布局文件时,出现了未绑定前缀错误。我该怎么解决这个问题

My layout.xml

    <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"
    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="com.example.dizikolikk.MainActivity" >


<android.support.v7.widget.Toolbar

   android:id="@+id/my_toolbar"
   android:layout_width="match_parent"
   android:layout_height="?attr/actionBarSize"
   android:background="?attr/colorPrimary"
   android:elevation="4dp"
   android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
   app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

</RelativeLayout>

在XML布局中使用未定义的命名空间(在本例中是“应用”命名空间)时,会发生此错误

您需要添加

xmlns:app="http://schemas.android.com/apk/res-auto"

到您的XML布局。

当您在XML布局中使用未定义的命名空间(在本例中是“应用”命名空间)时,会发生此错误

您需要添加

xmlns:app="http://schemas.android.com/apk/res-auto"
到您的XML布局