【发布时间】:2018-11-29 05:49:38
【问题描述】:
我想为Chip设置自定义可绘制背景,就像那个chip.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.bg_cutom_drawable));
但它不起作用。它给出了一个错误
java.lang.UnsupportedOperationException: Do not set the background resource; Chip manages its own background drawable.
它需要一个chipDrawable。如何为其创建chipDrawable。我试过但无法找到解决方案。 请建议我,不胜感激。
【问题讨论】:
-
不确定是不是你的情况,但是有
chipStrokeColor和chipStrokeWidth属性来设置笔触,那么你可以使用颜色资源而不是drawable。
标签: android-chips