customize check box preference

There are two ways to achieve what you need, first is to define custom checkbox layout custom_chexbox.xml at res/layout:

<?xml version="1.0" encoding="UTF-8"?>
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/checkbox" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:focusable="false"
android:clickable="false" android:button="@drawable/android_button"/>

Then you need to specify this layout for the preference:

<CheckBoxPreference android:key="@string/Drop_Option"
 android:title="Close after call drop" android:defaultValue="true"
 android:widgetLayout="@layout/custom_checkbox"/>

Second way is to create a custom theme, redefine style for checkbox views and apply the theme to the preferences activity, see How to customize the color of the CheckMark color in android in a dialog. : android for details.

Leave a Comment