简体   繁体   English

更改android芯片图标位置

[英]Change android chip icon position

I have added a few chips in my app.我在我的应用程序中添加了一些筹码。 The default chip have tick icon when you select it like this.当你这样选择它时,默认芯片有勾号图标。 在此处输入图像描述

I want to change the icon position to the bottom.我想将图标位置更改为底部。 Like this.像这样。 在此处输入图像描述

There is no property to change the icon position.没有更改图标位置的属性。 How can I achieve this result.我怎样才能达到这个结果。

use this property to change chip icon position:使用此属性更改芯片图标位置:

android:layoutDirection="rtl"

You could set android:layoutDirection="rtl" or the opposite of your current direction to put the icon on the right.您可以设置android:layoutDirection="rtl"或与当前方向相反的方向以将图标放在右侧。

For more: https://material.io/design/usability/bidirectionality.html更多信息: https ://material.io/design/usability/bidirectionality.html

Start icon启动图标

app:chipIconVisible — visibility of the chip icon. app:chipIconVisible — 芯片图标的可见性。 app:chipIcon — drawable icon to show at the start of the chip. app:chipIcon — 显示在芯片开头的可绘制图标。 app:chipIconSize — size of the chip icon. app:chipIconSize — 芯片图标的大小。

chip.setOnClickListener {
   // Handle chip click
}

close icon关闭图标

app:closeIconVisible — visibility of the close icon. app:closeIconVisible — 关闭图标的可见性。 app:closeIcon — drawable icon show at end of the chip. app:closeIcon — 可绘制图标显示在芯片的末尾。 app:closeIconSize — size of the close icon. app:closeIconSize — 关闭图标的大小。

chip.setOnCloseIconClickListener {
    // Handle chip close icon click
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM