Android材质芯片 [英] Android material chips
问题描述
我想在我的应用程序中实现带有芯片的自动完成编辑文本,并且希望通过在这里完成的方式来实现:库,但我不知道该如何使用(我可以使用它) )以自动填充我的数据集...以前有没有人使用过该库并且可以分享他们的经验?
I want to implement an autocomplete edittext with chips in my application and I want to do it in a way that it's done here: material design chips. First I would like to ask if there is some kind of widget (maybe as part of the new support library) or a solution that I can use for easy implementation. (I know that this question has been asked before but I just want to know if something changed in the meantime). Also I found this library, but I don't know how can I use it (and can I use it) for autocompletion of my sets of data... Has anyone worked with this library before and can share their experience?
任何帮助将不胜感激!
推荐答案
新的材质Android组件包含组件您可以使用以下方法将芯片添加到布局文件中:
You can add the chip to your layout file with:
<com.google.android.material.chip.Chip
android:id="@+id/some_chip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a chip" />
使用经典的设计支持库28.0.0 您可以使用该软件包:
With the classic Design Support Library 28.0.0 you can use the package:
<android.support.design.chip.Chip
../>
您可以使用以下属性来自定义组件:
You can customize the component using these attributes:
-
android:checkable
:如果使用true
,则可以切换芯片.如果是false
,则芯片的作用就像一个按钮 -
app:chipIcon
:用于在芯片内显示图标 -
app:closeIcon
:用于显示芯片内的关闭图标
android:checkable
: Iftrue
, the chip can be toggled. Iffalse
, the chip acts like a buttonapp:chipIcon
: Used to display an icon within the chipapp:closeIcon
: Used to display a close icon within the chip
您可以在此处找到正式的文档.
You can find the official documentation here.
这篇关于Android材质芯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!