lakshman lakshman - 1 month ago 9
Android Question

How to fix error: Error parsing XML: unbound prefix

I am writing an application that consists of the Library downloaded from here and i am getting an error called "Error parsing XML:Unbound prefix" how to fix this error and this is my XML please make it solve

<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>

Answer

I think you should replace

  <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">

with

  <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">

Source: the demo project included in the link you provided in your question

Comments