在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):pchmn/MaterialChipsInput开源软件地址(OpenSource Url):https://github.com/pchmn/MaterialChipsInput开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):[CURRENT SITUATION OF THE LIBRARY]First version of the library is not maintained. A new version entirely rewritten in kotlin is currently paused. MaterialChipsInputImplementation of Material Design Chips component for Android. The library provides two views : DemoSetupTo use this library your In your project level build.gradle : allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
} In your app level build.gradle : dependencies {
compile 'com.github.pchmn:MaterialChipsInput:1.0.8'
} ChipsInputThis view implements the Material Design Contact chips component. It is composed of a collection of chips ( But everything is configurable (optional avatar icon, optional full detailed view, ...) so you can use the Basic UsageXMLUse the ChipsInput view in your layout with default options : <com.pchmn.materialchips.ChipsInput
android:id="@+id/chips_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="Enter a name" /> You can also customize it (see all attributes) : <com.pchmn.materialchips.ChipsInput
android:id="@+id/chips_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="Enter a name"
app:hintColor="@color/customColor"
app:textColor="@color/customColor"
app:maxRows="3"
app:chip_labelColor="@color/customColor"
app:chip_hasAvatarIcon="true"
app:chip_backgroundColor="@color/customColor"
app:chip_deletable="false"
app:chip_deleteIconColor="@color/customColor"
app:chip_detailed_textColor="@color/customColor"
app:chip_detailed_backgroundColor="@color/customColor"
app:chip_detailed_deleteIconColor="@color/customColor"
app:filterable_list_backgroundColor="@color/customColor"
app:filterable_list_textColor="@color/customColor" /> SuggestionsYou can pass a
1. Create a class that implements |
Attribute | Type | Description | Default |
---|---|---|---|
app:hint |
string |
Hint of the input when there is no chip | null |
app:hintColor |
color |
Hint color | android default |
app:textColor |
color |
Text color when user types | android default |
app:maxRows |
int |
Max rows of chips | 2 |
app:chip_labelColor |
color |
Label color of the chips | android default |
app:chip_hasAvatarIcon |
boolean |
Whether the chips have avatar icon or not | true |
app:chip_deletable |
boolean |
Whether the chips are deletable (delete icon) or not | false |
app:chip_deleteIconColor |
color |
Delete icon color of the chips | white/black |
app:chip_backgroundColor |
color |
Background color of the chips | grey |
app:showChipDetailed |
boolean |
Whether to show full detailed view or not when touching a chip | true |
app:chip_detailed_textColor |
color |
Full detailed view text color | white/balck |
app:chip_detailed_backgroundColor |
color |
Background color of the full detailed view | colorAccent |
app:chip_detailed_deleteIconColor |
color |
Delete icon color of the full detailed view | white/black |
app:filterable_list_backgroundColor |
color |
Background color of the filterable list of suggestions | white |
app:filterable_list_textColor |
color |
Text color of the filterable list of suggestions | black |
This view implements the chip component according to the Material Design guidelines with configurable options (background color, text color, ...).
<com.pchmn.materialchips.ChipView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:label="Chip 1" />
<com.pchmn.materialchips.ChipView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:label="Chip 4"
app:hasAvatarIcon="true" />
<com.pchmn.materialchips.ChipView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:label="Chip 6"
app:labelColor="@android:color/white"
app:avatarIcon="@drawable/avatar"
app:backgroundColor="@android:color/holo_blue_light"
app:deletable="true"
app:deleteIconColor="@android:color/white" />
Attribute | Type | Description | Default |
---|---|---|---|
app:label |
string |
Label of the chip | null |
app:labelColor |
color |
Label color of the chip | android default |
app:hasAvatarIcon |
boolean |
Whether the chip has avatar icon or not | false |
app:avatarIcon |
drawable |
Avatar icon resource | null |
app:deletable |
boolean |
Whether the chip is deletable (delete icon) or not | false |
app:deleteIconColor |
color |
Delete icon color of the chip | grey |
app:backgroundColor |
color |
Background color of the chip | grey |
ChipView chip = (ChipView) findViewById(R.id.chip_view);
On chip click listener :
chip.setOnChipClicked(new View.OnClickListener() {
@Override
public void onClick(View view) {
// handle click
}
});
On delete button click listener :
chip.setOnDeleteClicked(new View.OnClickListener() {
@Override
public void onClick(View view) {
// handle click
}
});
A sample app with some use cases of the library is available on this link
You can also download the sample APK here
Copyright 2017 pchmn
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.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论