Add following
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Import the library into gradle
dependencies {
implementation 'com.github.mudassirzulfiqar:TagFilter:0.4-beta'
}
Define layout in your xml file.
your_layout.xml
<com.github.mudassirzulfiqar.ChipFilter
android:id="@+id/chip_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5sp" />
ChipFilter chipFilter = findViewById(R.id.chip_filter);
chipFilter.init(this);
chipFilter.addFilter(new Filter("Bus", "0", R.drawable.ic_bus, "", true));
chipFilter.addFilter(new Filter("Train", "1", R.drawable.ic_train, "", false));
chipFilter.addFilter(new Filter("Car", "2", R.drawable.ic_card, "", false));
chipFilter.setOnFilterSelectListener(new ChipFilter.FilterSelect() {
@Override
public void onSelect(Filter tag) {
Toast.makeText(MainActivity.this, "" + tag.getTitle(), Toast.LENGTH_SHORT).show();
}
});
Filter selectedChip = chipFilter.getSelectedChip();
- File bug report
- Request feature
- Create Pull request
- Mudassir Zufiqar - Linkedin
This project is licensed under the Apache 2.0 License.
- Inspiration - Google Maps Filter