【发布时间】:2012-06-17 11:09:12
【问题描述】:
我已经定义了一个像这样绘制的矩形:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dip"/>
<solid android:color="#FF000000" />
<stroke android:width="1dip" android:color="@color/service_checkbox_disabled_unchecked_stroke" />
</shape>
我可以毫无问题地将 drawble 显示为 imageView。但是,它应该是复选框的一种状态的可绘制对象。我的复选框按钮的选择器是这样定义的:
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true" android:drawable="@drawable/bg_services_tick_unchecked_disabled" />
<item android:state_checked="false" android:drawable="@drawable/bg_services_tick_unchecked_disabled" />
</selector>
最后是我的复选框:
<CheckBox
android:id="@+id/cb_tariff_3_next_month_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/checkbox_services"
android:layout_centerHorizontal="true"/>
谁能告诉我,为什么这不起作用?非常感谢。
【问题讨论】:
-
请接受以下答案。这是非常晦涩的知识点,值得承认。 (我不是海报)。