Giter Site home page Giter Site logo

tagview's Introduction

Release

TagView

This libirary help to pick up Text as Tag. Like Skill selection or other things what you want. You can call it Tag 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 on flexbox

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

Ok Now starts Implementation part. You have to set just follwoing xml Note: 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 set Tag in two way 1.Typing text and enter Special Character 2.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 will return TagModel List

There are following property that you can use in XML section

Attributes Purpose
app:tag_text_color To change Tag text color
app:tag_background_color To change Tag Background color
app:tag_limit To set how many tag will set
app:close_icon To set remove button of each tag
app:limit_error_text To set message if tag reach its limit
app:tag_separator To set Special 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 Name Purpose
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

tagview's People

Contributors

mahimrocky avatar w3-tariqul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tagview's Issues

How to limit the length of tag characters?

Thank you for making this library.
I am Korean and I am not good at writing English, so I hope you understand.

If I type a long letter, the x-button disappears and it is impossible to delete it.

And if the word is short, the alignment is skewed to the right.

How to access the EditText and TextView?

Calling setTagList(...) twice results in java.lang.IllegalStateException

Hello, calling setTagList(...) twice results in "java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.".

Why need to call setTagList(...) several times? For example to restore current state when navigating between fragments, updating field from a view model.

com.sun.tools.javac.code.Symbol$CompletionFailure

com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.google.android.flexbox.FlexboxLayout not found.

When I try to get TagView
TagView tagView = findViewById(R.id.tag_view_test);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.