I'm developing a application for Android v2.1 and I search how I can change the color of the "check" for a Che开发者_运维知识库ckBox component?
You can't. The check box is drawn as an image.
That means there is no way to change the appearance of the check box, apart from modifying the graphics and bundling with your app. Look insode android-sdk-linux_86/platforms/android-8/android.jar in /res/drawable-hdpi/ .
There you find btn_check_*.png which you must modify and then follow instructions stated here: Custom checkbox image android .
Me faced same Problem , got solutions using below Technic
Copy the btn_check.xml
from android-sdk/platforms/android-#(version)/data/res/drawable
to your project's drawable folder and change the 'on' and 'off' image states to your custom images.
Then your xml will just need android:button="@drawable/btn_check"
<CheckBox
android:button="@drawable/btn_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
If you want to use different default android icons, you can use android:button="@android:drawable/..."
.
精彩评论