Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

The tag selection library with edit text and list

NotificationsYou must be signed in to change notification settings

mahimrocky/TagView

Repository files navigation

Release

TagView

This libirary help to pick up Text as Tag. LikeSkill selection or other things what you want. You can call itTag with EditText You can select specicfic text from showing list or from editText text. Easy to us and Simple library

Sample

Root Gradle

    allprojects {repositories {...maven { url'https://jitpack.io' }}}

App Gradle:

you have to add below two dependency. Because library was build onflexbox

dependencies {           implementation'com.google.android:flexbox:1.0.0'   implementation'com.github.mahimrocky:TagView:1.0.3'}

Ok Now startsImplementation part. You have to set just follwoingxmlNote: No need to add extra Edit text for Tag selection. The xml file will auto provide

<com.skyhope.materialtagview.TagView        android:id="@+id/text_view_show_more"        android:layout_width="match_parent"        android:layout_height="wrap_content"        />

And now here we wil discuss how we can use different property

In Activity you can use like:

    TagView tagView = findViewById(R.id.tag_view_test);

User can setTag in two way1.Typing text and enterSpecial Character2.Select item from provided list

So if you want to provide String list you can predefine Tag list by using:

    tagView.addTagSeparator(TagSeparator.AT_SEPARATOR); // @ seprator

or in XML you can set

    app:tag_separator="HASH_SEPARATOR" // Hash seperator

To get Tag add or Remove listener

    tagView.initTagListener(TagItemListener listener); // You can implement it

To get selected tag

tagView.getSelectedTags();// that willreturn TagModel List

There are following property that you can use inXML section

AttributesPurpose
app:tag_text_colorTo change Tag text color
app:tag_background_colorTo change Tag Background color
app:tag_limitTo set how many tag will set
app:close_iconTo set remove button of each tag
app:limit_error_textTo set message if tag reach its limit
app:tag_separatorTo setSpecial Character that entering in EditText will create a tag

How you can set predefine tag list?You can set List of String or array of String

String[] tagList = new String[]{"Hello1","Hello2","Hello3"};tagView.setTagList(tagList);

The following methods to change property of tag

Mtehod NamePurpose
addTagLimit(int limit)To set Tag limit
setTagBackgroundColor(int color)To set Tag background color
setTagBackgroundColor(String color)To set Tag background color
setTagTextColor(int color)To set Tag text color
setTagTextColor(String color)To set Tag text color
setMaximumTagLimitMessage(String message)To set Tag limit warning message
setCrossButton(Drawable crossDrawable)To set Tag remove button
setCrossButton(Bitmap crossBitmap)To set Tag remove button
setTagList(List<String> tagList)To set Predefine Tag list
setTagList(String... tagList)To set Predefine Tag list as String array
getSelectedTags()To get all selected TagList

Happy Coding


[8]ページ先頭

©2009-2025 Movatter.jp