![](/img/trans.png)
[英]Android Chip_How to make chip background color transparent programmatically?
[英]How to make chip background transparent in android?
我正在使用动作芯片,例如:
<com.google.android.material.chip.Chip
android:id="@+id/copyLinkChip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_link"
app:chipIcon="@drawable/content_copy_background"
app:chipIconTint="?attr/primaryText"
android:textColor="?attr/primaryText"
app:chipStrokeWidth="0.5dp"
/>
我想让它的背景完全透明怎么做?
尝试这个
chip.setChipBackgroundColor(getResources().getColorStateList(android.R.color.transparent));
您可以通过setChipBackgroundColorResource API 以编程方式设置它:
copyLinkChip.setChipBackgroundColorResource(android.R.color.transparent)
或通过 XML
app:chipBackgroundColor="@android:color/transparent"
您可以在 XML 中使用属性app:chipBackgroundColor
chipBackgroundColor
app:chipSurfaceColor="@android:color/transparent"
app:chipBackgroundColor="@android:color/transparent"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.