"Namespace 'TagsEditText' is not bound" but when replacing it with app everything is correct

1

Using the following library, link I follow steps 1, 2 and 3 indicated by the developer but in the layout receipt the following error:

"Namespace 'TagsEditText' is not bound"

The written code is the same as indicated in step 3:

<mabbas007.tagsedittext.TagsEditText
        android:id="@+id/tagsEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        TagsEditText:allowSpaceInTag="true"
        TagsEditText:tagsCloseImageRight="@drawable/tag_close"
        TagsEditText:tagsBackground="@drawable/square"
        TagsEditText:tagsCloseImageLeft="@drawable/dot"
        TagsEditText:tagsTextColor="@color/blackOlive"
        TagsEditText:tagsTextSize="@dimen/defaultTagsTextSize"
        TagsEditText:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"/>

This is how the code works correctly:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="gastuak.nire.aldakur.net.niregastuak.MainActivity"
    tools:showIn="@layout/activity_main"
    android:gravity="center_horizontal">



    <mabbas007.tagsedittext.TagsEditText
            android:id="@+id/tagsEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:allowSpaceInTag="true"
            app:tagsCloseImageRight="@drawable/tag_close"
            app:tagsBackground="@drawable/square"
            app:tagsCloseImageLeft="@drawable/dot"
            app:tagsTextColor="@color/blackOlive"
            app:tagsTextSize="@dimen/defaultTagsTextSize"
    app:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"/>


</LinearLayout>

Substituting TagsEditText for app: the error disappears and the app works correctly. I would like to know the reason for this.

    
asked by aldakur 03.11.2016 в 17:44
source

2 answers

1

The reason is that in the example we used another namespace for link

Instead of using% co_of% which is the usual, use app as namespace view

The xmlns can have the name you want, but then you must refer to the one you defined, which can be:

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

This can be seen by checking the code of TagsEditText in the layout activity_main.xml :

xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
    
answered by 03.11.2016 / 19:59
source
1

This error

  

"Namespace '...' is not bound"

It happens because you do not use the correct namespace defined by the class used.

If you check the code of TagsEditText , you can see which one is correct:

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

for example in the layout activity_main.xml

    
answered by 03.11.2016 в 20:08