Using the following library, https://github.com/mabbas007/TagsEditText , I follow steps 1, 2 and 3 indicated by the developer, but layout
I receive 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>
Replacing the error disappears and the app works correctly TagsEditText
. app:
I would like to know the reason for this.
The reason is that in the example a different namespace was used for http://schemas.android.com/apk/res-auto
Instead of using
app
what is usual, use seeTagsEditText
as namespaceThe xmlns can have whatever name you want, but then you must refer to the one you defined, which could be:
xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ejemplo="http://schemas.android.com/apk/res-auto"
This can be seen by reviewing the TagsEditText code in the activity_main.xml layout :
this bug
It happens by not using the correct namespace defined by the class used.
If you check the TagsEditText code , you can see which one is correct:
for example in the layout activity_main.xml