Giter Site home page Giter Site logo

smile4ever4u / chiplayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amaldevta/chiplayout

0.0 2.0 0.0 148 KB

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)

License: Apache License 2.0

Java 100.00%

chiplayout's Introduction

Android Arsenal

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   
        chipColor_   		    format=  color   
        showText_   	    	format=  boolean   
        showDeleteButton_   	format=  boolean   
        deleteIcon_   	    	format=  reference   
        chipDrawable_   		format=  reference   
        chipLayoutDrawable_   	format=  reference   
        labelPosition_   		format=  (left/right) 

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 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.4'

OR

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

chiplayout's People

Contributors

officialamal avatar

Watchers

James Cloos avatar  avatar

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.