我想覆盖可绘制对象(特别是切换开关)的color属性并使其透明,我意识到这可以通过编程来完成,但是有没有办法在XML本身中做到这一点?
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/transparent" android:state_checked="true" android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00012" />
<item android:color="@android:color/transparent" android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00001" />
</selector>
上面的代码似乎对颜色没有影响
如何使用一个空的?为自己定义一个高度和宽度匹配的空可绘制对象。
[请记住,Android无法那样工作(可悲),无法在可绘制对象中进行覆盖,但是这样做会很不错,但是尽管这样会导致滥用,因为这会消耗一些原始功率,在某些情况下可能无法使用设备。