如何修复错误:解析XML时出错:未绑定的前缀

时间:2015-01-31 05:17:49

标签: android xml

我正在编写一个包含从here下载的库的应用程序,我收到一个名为" 解析XML时出错的错误:未绑定前缀"如何解决这个错误,这是我的XML,请让它解决

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
          <com.gc.materialdesign.views.ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">


        <com.gc.materialdesign.views.ButtonRectangle
                    android:id="@+id/button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:background="#1E88E5"
                    android:text="Button" />
    <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="32dp"
                android:layout_marginLeft="24dp" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="Float Button" />

                <View
                    android:layout_width="fill_parent"
                    android:layout_height="1dp"
                    android:layout_alignParentBottom="true"
                    android:background="#1E88E5" />



    </RelativeLayout>
        </com.gc.materialdesign.views.ScrollView>
  <!-- Error Occurred Here -->         <com.gc.materialdesign.views.ButtonFloat
                    android:id="@+id/buttonFloat"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentBottom="true"
                    android:layout_marginRight="24dp"
                    android:background="#1E88E5"
                    materialdesign:animate="true"
                    materialdesign:iconDrawable="@drawable/pencil" />


    </RelativeLayout>

2 个答案:

答案 0 :(得分:1)

我认为你应该替换

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        xmlns:tools="http://schemas.android.com/tools">

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools">

来源:the demo project included in the link you provided in your question

答案 1 :(得分:0)

在您的父亲相对布局

中添加此行

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