alibehzadian / PersianDatePicker

An Android DatePicker for Persian Calendar
Apache License 2.0
90 stars 20 forks source link

Error parsing XML: unbound prefix #1

Closed hoseinit closed 9 years ago

hoseinit commented 9 years ago

Hi I have imported the project as a Library I face to this problem when I want to add attributes like app:maxYear="1450" to my layout file. without any attributes the simple following tag will work <ir.smartlab.persindatepicker.PersianDatePicker android:layout_width="wrap_content" android:layout_height="wrap_content"/>

alibehzadian commented 9 years ago

What is the exact problem?

hoseinit commented 9 years ago

it's in the title "Error parsing XML: unbound prefix"

alibehzadian commented 9 years ago

You need to add xml namespace to your layout file as below: xmlns:app="http://schemas.android.com/apk/res-auto" to be able to use custom attributes defined in this library.

hoseinit commented 9 years ago

Hello again I did import the project from both methods mentioned in your website, I noted and already added xml namespace. I even changed build target from 4.2.2 to 4.4 and ... I don't know what else I have to do to make it work. The problem rises when I want to add any styles to the view like app:displayMonthNames="true" without the styles it works

Thank you in advance

alibehzadian commented 9 years ago

Hi Use this sample code. It works for me and is based on the real app (FaraYad):

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<!-- ... -->
    <view 
          android:id="@+id/endDatePickerView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          class="ir.smartlab.farayad.widget.PersianDatePicker"
          app:displayMonthNames="true" />
hoseinit commented 9 years ago

Thank you very much. It was kind of you to help me out here