简体   繁体   English

Android 芯片_如何通过程序使芯片背景色透明?

[英]Android Chip_How to make chip background color transparent programmatically?

I want to make the android chip background color to transparent.我想让android芯片背景色变成透明。

From material version higher than 1.1.0,从高于 1.1.0 的材料版本,
we need to set app:chipBackgroundColor="@color/transparent" but also app:chipSurfaceColor="@color/transparent"我们需要设置app:chipBackgroundColor="@color/transparent"但也需要设置 app:chipSurfaceColor= app:chipSurfaceColor="@color/transparent"

Ok, I see.好的我明白了。 But how can it do by kotlin code?但是 kotlin 代码怎么办?

background color can be set by code below...背景颜色可以通过下面的代码设置...

chipBackgroundColor = ColorStateList.valueOf(ContextCompat.getColor(context, android.R.color.transparent))

But, I can't find the code that changes its surface color!!但是,我找不到改变其表面颜色的代码!!

Is there any solution?有什么解决办法吗?

chip.chipBackgroundColor = getColorStateList(your color) chip.chipBackgroundColor = getColorStateList(你的颜色)

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

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