Top Android ChipView Libraries

Typically these UI elements grace our apps with filtered options, tagged content, and contact lists. There are libraries out there that make adding chips to your app as easy as pie… or should I say, as easy as chips? Let's dive into some of the best ChipView libraries for Kotlin Android development.

1. Introduction to Material Chips

Before we jump into third-party libraries, let's not forget that Android's own Material Design Components library offers a robust implementation of chips. It's maintained by Google, which means it's likely to be up-to-date with the latest design trends and best practices.

Features:

  • Variety: Supports different types of chips like Choice Chip, Filter Chip, and Input Chip.
  • Customization: Offers extensive customization options to match your app's theme.
  • Accessibility: Built with accessibility in mind, ensuring a better experience for all users.
  • Animation: Provides subtle animations that enhance user interactions.

Installation:

Add the dependency to your build.gradle (Module: app) file:

dependencies {
    implementation 'com.google.android.material:material:1.4.0'
}

Code Example:

<com.google.android.material.chip.ChipGroup
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/chip_group"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:singleSelection="true"
    app:checkedChip="@+id/chip1">

    <com.google.android.material.chip.Chip
        android:id="@+id/chip1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Chip 1"
        app:chipBackgroundColor="@color/chip_background_color"
        app:checkedIconEnabled="true" />

    <com.google.android.material.chip.Chip
        android:id="@+id/chip2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Chip 2"
        app:chipBackgroundColor="@color/chip_background_color" />

    <!-- More chips as needed -->
</com.google.android.material.chip.ChipGroup>

Here we have a ChipGroup that manages a set of Chip views. We've set singleSelection to true to allow only one chip to be selected at a time. Each Chip can be customized with different background colors and icons.

Comparison:

The Material Chips library is a solid choice due to its official support and integration with Material Design guidelines. It's a go-to for many developers who want a reliable and standardized implementation without the need for additional third-party libraries.

Reference:

2. Flexible Chips View

ChipsLayoutManager is another third-party library that aims to provide a more flexible and customizable chips experience.

Features:

  • Dynamic Chips: Easily add or remove chips at runtime.
  • Flow Layout: Chips can be arranged in a flow layout, wrapping to the next line as needed.
  • Customizable: Offers various customization options for styling and behavior.
  • Listener Support: Provides listeners for chip events like click and delete.

Installation:

Add the dependency to your build.gradle (Module: app) file:

dependencies {
    implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7'
}

Code Example:

val chipsLayoutManager = ChipsLayoutManager.newBuilder(this)
    .setChildGravity(Gravity.CENTER)
    .setScrollingEnabled(true)
    .build()

recyclerView.layoutManager = chipsLayoutManager
recyclerView.adapter = chipAdapter

// Adding a chip dynamically
val chip = Chip(this)
chip.text = "Dynamic Chip"
chip.isCloseIconVisible = true
chipAdapter.addChip(chip)

// Listener for chip delete
chip.setOnCloseIconClickListener {
    chipAdapter.removeChip(chip)
}

Explanation: This Kotlin snippet demonstrates how to set up a RecyclerView with a ChipsLayoutManager for a flexible chip layout. Chips can be added dynamically, and listeners can be set for user interactions like closing a chip.

Comparison:

ChipsLayoutManager is all about flexibility and ease of use. It's particularly useful when you need to manage a large number of chips that can change dynamically based on user input or data changes.

Reference:

3. ChipCloud

ChipCloud for creating tag cloud or chip list.

Key Features:

  • Easy to add chips dynamically.
  • Customizable styles.
  • Single and multi-select modes.

Installation:

implementation 'com.github.adroitandroid:chipcloud:1.0.5'

Code Example:

import net.adroitandroid.chipcloud.ChipCloud

val chipCloud = findViewById<ChipCloud>(R.id.chip_cloud)
chipCloud.addChip("Chip 1")
chipCloud.addChip("Chip 2")

Explanation: After initializing ChipCloud, we add chips simply by calling addChip. It's straightforward for creating a list of tags.

Comparisons: ChipCloud simpler and more focused on tag clouds. It's less versatile than Material Components but easier for specific scenarios.

Visit ChipCloud GitHub for more details.

4. FlexboxLayout

FlexboxLayout by Google, great for chips as it handles wrapping automatically.

Key Features:

  • Flexbox layout algorithms.
  • Responsive design support.
  • Ideal for chips as it wraps them based on available space.

Installation:

implementation 'com.google.android.flexbox:flexbox:3.0.0'

Code Example:

import com.google.android.flexbox.FlexboxLayout
// Assuming you have a FlexboxLayout in your layout XML
val flexboxLayout = findViewById<FlexboxLayout>(R.id.flexbox_layout)
val chip = Chip(this).apply {
    text = "Flexbox Chip"
}
flexboxLayout.addView(chip)

Explanation: We add a Chip to FlexboxLayout. FlexboxLayout ensures chips wrap nicely across multiple lines if space is limited.

Comparisons: FlexboxLayout offers more layout flexibility compared to other chip implementations. It doesn't provide chip functionality directly but is excellent for layout management.

More information at FlexboxLayout GitHub.

5. Nachos

Nachos is for entering tags and selecting from a list.

Key Features:

  • Editable chip input.
  • Suggestions dropdown.
  • Customizable chip styles.

Installation:

implementation 'com.hootsuite.android:nachos:1.1.1'

Code Example:

import com.hootsuite.nachos.NachoTextView
import com.hootsuite.nachos.terminator.ChipTerminatorHandler

val nachoTextView = findViewById<NachoTextView>(R.id.nacho_text_view)
nachoTextView.addChipTerminator(',', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_ALL)

Explanation: NachoTextView allows users to input text, automatically converting entered text into chips on specific characters like ,.

Comparisons: Nachos unique for editable chip input and suggestions. It's more suitable for forms where users can enter tags.

Check out Nachos GitHub for more.

6. ChipView of Material:

ChipView library of Material is strong and can change easily, following Material Design rules. It has many ways to make it your own, like changing the shape, color, and icons of chips. To put this library in your app, you need to add this line in your app's build.gradle file:

implementation 'com.github.robertlevonyan:material-chip-view:1.2.0'

How to use it (Kotlin):

val chipGroup: ChipGroup = findViewById(R.id.chipGroup)

val chip = Chip(this)
chip.text = "Example Chip"
chip.canClick = true
chip.canCheck = true
chipGroup.addChip(chip)

Additional ChipView Libraries:

  1. ChipsLayoutManager: A flexible chip library that provides a customizable chip layout manager. GitHub Repository

  2. ChipCloud: A lightweight chip library that supports customizable chip styles and animations. GitHub Repository

  3. ChipEditText: A chip library designed specifically for EditText fields, supporting chip insertion and deletion. GitHub Repository

  4. ChipRecyclerView - ChipRecyclerView library helps in showing chip views that can be laid out in horizontal direction, and can flex their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent..

  5. ChipViewGroup - An android library to add chips in your activity.

  • ChipCloud - Android UI library that creates 'chip' clouds.
  • ChipLayout - ChipLayout is an opensource Android library. ChipLayout is an layout which create chips from the text you type and also allow you to show drop down(like MultiautocompleteTextView).
  • TagView - The tag selection library with edit text and list.
  • MaterialChipsInputDemo - Using the new material library from google to implement Chips just like the Gmail app. Using commas to generate new chips from EditText inside ChipGroup and deleting them on close icon click or backspace press from soft keypad..
  • ChipTextViewHelper - Android demo app/library for easy implementation of chip-like text in your TextViews (EditText, AutoCompleteTextView, etc..).
  • nanochips - Customizable Android chips library.
  • ExtendedChipGroup - ExtendedChipGroup extend from ChipGroup which was added in google material library. I added a function to control the max number of lines, as well as buttons for while / hiding chips.
  • ChipRecyclerView - ChipRecyclerView library helps in showing chip views that can be laid out in horizontal direction, and can �flex� their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent..
  • chips-input - This library is modified and reduced type of Android Open Source Project (RecipientEditText.java).
  • AndroidChips - One of the cool widgets that you can use with the Material Design Components library is Chip. A Chip is a component that can represent input, filter, choice or action of a user..
  • AndroidFTDI - Library that allows to communicate with FTDI chip from Android application.
  • AndroidChipsUI - Based on https://github.com/kpbird/chips-edittext-library.
  • ChipViewGroup - An android library to add chips in your activity.
  • MaterialChip - A Library of Material Chips in Android.
  • EmojiTags - A simple Android library to display chips with auto suggested Emojis.