私のXMLには1つが含まれていますCheckBox
。Androidでプログラムでチェックボックスの境界線の色を変更する方法.
私のサンプルスクリーンショットはこちら
スクリーンショット
ありがとう。
設定できます
check.setButtonDrawable(mContext.getResources().getDrawable(
R.drawable.radio));
ではradio.xml
、チェック ボックスに任意の背景を設定できます。
radio.xml で
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/option_unselected" android:state_checked="false"/>
<item android:drawable="@drawable/option_selected" android:state_checked="true"/>
</selector>
ここで、option_selected と option_selected は、選択された状態と選択されていない状態のグラフィックです。
詳細については、 http://developer.android.com/guide/topics/resources/drawable-resource.html#StateListを確認してください。