What does unbound prefix mean, when parsing XML?

前端 未结 3 1125
野趣味
野趣味 2021-01-04 06:29

I Have made a xml file in my android app for the Custom Widget and the error is:

Error parsing XML: unbound prefix

Here is my x

3条回答
  •  我在风中等你
    2021-01-04 06:38

    The second XML namespace is correct however it is the namespace of your custom widget so you need to define the name space appropriately:

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

    becomes:

    xmlns:mynamespace="http://schemas.android.com/apk/res/com.myproject.myprojectname"
    

    Thereafter any custom attribute elements you define for your custom view will be referred to as:

    mynamespace:my_defined_attribute="success"
    

    instead of :

    android:layout_width="fill_parent"
    

提交回复
热议问题