Skip to content

Repository files navigation

HashTagEditText

EditText for multiple tags input.

Demo

Importing the library

You can import this library to your project by adding following dependency to your build.gradle:

dependencies {
implementation 'id.stevenlewi:hashtag-edittext:1.0.1'
}

How to Use

XML:

<id.stevenlewi.hashtagedittext.HashTagEditText
android:id="@+id/tag_input"android:layout_width="match_parent"android:layout_height="wrap_content" />
<id.stevenlewi.hashtagedittext.HashTagEditText
android:id="@+id/tag_input"android:layout_width="match_parent"android:layout_height="wrap_content"app:bubbleTextColor="#555"app:bubbleTextSize="16sp"app:horizontalPadding="8dp"app:horizontalSpacing="2dp"app:maxSize="10"app:bubbleBackground="@drawable/custom_background"app:verticalPadding="4dp"app:verticalSpacing="2dp" />
View AttributeTypeDescription
bubbleTextColorColorText color for each bubble
bubbleTextSizeDimenText size for each bubble
horizontalPaddingDimenLeft and right padding for each bubble
verticalPaddingDimenTop and bottom padding for each bubble
horizontalSpacingDimenTop and bottom padding for each bubble
verticalSpacingDimenTop and bottom padding for each bubble
maxSizeIntMaximum tag allowed to enter
bubbleBackgroundDrawable or ColorCustom background for bubble

Code:

// Insert single tag
hashTagEditText.appendTag("hello")
// Insert multiple tags
hashTagEditText.appendTags("android", "kotlin", "tags", "edit-text")
hashTagEditText.appendTags(listOf("github", "opensource"))
// Get tags value as list of stringval allTags = hashTagEditText.values
// Don't set text directly like this (not supported yet)// hashTagEditText.setText("android,kotlin")

License

Copyright (C) 2023 Steven Lewi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

EditText for Hashtags input

Topics

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages