tôi đã xác định đối tượng vẽ được hình chữ nhật như thế này:Rectangle hình drawable sẽ không hiển thị như hộp kiểm item selector
<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>
tôi có thể hiển thị các drawble như IMAGExem không có vấn đề. Tuy nhiên, nó là nghĩa vụ phải là một drawble cho một trạng thái của một hộp kiểm. chọn của tôi cho nút checkbox được định nghĩa như thế này:
<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>
Và cuối cùng hộp kiểm của tôi:
<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"/>
bất cứ ai có thể nói, tại sao không làm việc? Cảm ơn nhiều.
Hãy chấp nhận câu trả lời dưới đây. Đây là một chút kiến thức mơ hồ bất thường và xứng đáng được công nhận. (Tôi không phải là người đăng). –