ChipLayout


Source link: https://github.com/OfficialAmal/ChipLayout


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)

Example

Screenshots


Source code with examples is included in repository.

Usage

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:custom="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="#FFF"
  android:padding="10dp"
  android:orientation="vertical">
  <com.libaml.android.view.chip.ChipLayout

android:id="@+id/chipText"

android:layout_width="match_parent"

android:layout_height="wrap_content"

custom:textSize_="10dp"

custom:chipPadding_="4dp"

custom:chipTextPadding_="2dp"

custom:textColor_="@android:color/black"

custom:deleteIcon_="@android:drawable/presence_offline"

custom:chipDrawable_="@drawable/round_corner_drawable"

custom:chipLayoutDrawable_="@drawable/edittext_theme_landing_page"

custom:labelPosition_="left">
  </com.libaml.android.view.chip.ChipLayout> </LinearLayout> 

====== Find the View in your Activity or Fragment class.

  ChipLayout chip = (ChipLayout) findViewById(R.id.chipText);

String[] countries = {
"india","australia","austria","indonesia","canada"
}
;

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,countries);

chip.setAdapter(adapter);

 chip.setOnClickListener(ClickListener);

chip.setOnItemClickListener(ItemClickListener);

chip.addLayoutTextChangedListener(TextChangedListener);

chip.setOnFocusChangeListener(FocusChangeListener);

XML attributes



  textSize_

format=  dimension

  chipPadding_

format=  dimension

  chipPaddingLeft_
  format=  dimension

  chipPaddingRight_
 format=  dimension

  chipPaddingTop_
  format=  dimension

  chipPaddingBottom_
format=  dimension

  chipTextPadding_
  format=  dimension

  chipTextPaddingLeft_
 format=  dimension

  chipTextPaddingRight_
format=  dimension

  chipTextPaddingTop_
 format=  dimension

  chipTextPaddingBottom_  format=  dimension

  textColor_

  format=  color

hintColor_

  format=  color

chipColor_

format=  color

showText_

format=  boolean

showDeleteButton_
 format=  boolean

deleteIcon_

format=  reference

chipDrawable_
  format=  reference

chipLayoutDrawable_
 format=  reference

labelPosition_
  format=  (left/right)

hint_

 format=  string 

Public Fields


static int MAX_CHARACTER_COUNT

Public Methods


public void setOnClickListener(OnClickListener l)

 public void setOnItemClickListener(AdapterView.OnItemClickListener l)

  public void addLayoutTextChangedListener(TextWatcher textWatcher)

 public void removeLayoutTextChangedListener(TextWatcher textWatcher)

 public void setOnChipItemChangeListener(ChipItemChangeListener l)

 public void removeChipAt(int pos)

 public void removeAllChips()

 public void setAdapter(ArrayAdapter adapter)

 public void setText(List<String> vals)

 public void setTextColor(int textColor)

 public void setChipColor(int bgColor)

  public AdapterView.OnItemClickListener getOnItemClickListener()

 public ChipItemChangeListener getOnChipItemChangeListener()

 public int getTextColor()

 public int getChipColor()

 public List<String> getText()

 public ArrayAdapter getAdapter()

  public void highlightChipAt(int pos, Drawable bgDrawable, int textColor)

 public void highlightChipAt(int pos, int bgColor, int textColor)

Dependencies

Gradle

compile 'com.libaml.android.view.chip:AndroidChipLayout:1.0.6' 

OR

Module dependency -
Download folder 'AndroidChipLayout' and add as module dependency

Resources

Day or night switch-button.

Qart merges picture and QR code.

Convert audio files inside your Android app easily. Supported formats: WAV, AAC, MP3, M4A, WMA and FLAC.

Customizable, sensor-enabled, door sign custom views for Android.

Android Dialogs on steroids.

Android Promise wrappers for Apache Http client.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes