繁体   English   中英

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

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

我想让android芯片背景色变成透明。

从高于 1.1.0 的材料版本,
我们需要设置app:chipBackgroundColor="@color/transparent"但也需要设置 app:chipSurfaceColor= app:chipSurfaceColor="@color/transparent"

好的我明白了。 但是 kotlin 代码怎么办?

背景颜色可以通过下面的代码设置...

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

但是,我找不到改变其表面颜色的代码!!

有什么解决办法吗?

chip.chipBackgroundColor = getColorStateList(你的颜色)

暂无
暂无

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

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