Added in API level 1
Deprecated in API level 29

CheckBoxPreference


open class CheckBoxPreference : TwoStatePreference
kotlin.Any
   ↳ android.preference.Preference
   ↳ android.preference.TwoStatePreference
   ↳ android.preference.CheckBoxPreference

A Preference that provides checkbox widget functionality.

This preference will store a boolean into the SharedPreferences.

Summary

XML attributes
android:disableDependentsState The state (true for on, or false for off) that causes dependents to be disabled.
android:summaryOff The summary for the Preference in a PreferenceActivity screen when the CheckBoxPreference is unchecked.
android:summaryOn The summary for the Preference in a PreferenceActivity screen when the CheckBoxPreference is checked.
Inherited XML attributes
Inherited constants
Public constructors

CheckBoxPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

CheckBoxPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Protected methods
open Unit
onBindView(view: View!)

Binds the created View to the data for this Preference.

Inherited functions

XML attributes

android:disableDependentsState

android:disableDependentsState
The state (true for on, or false for off) that causes dependents to be disabled. By default, dependents will be disabled when this is unchecked, so the value of this preference is false.

May be a boolean value, such as "true" or "false".

android:summaryOff

android:summaryOff
The summary for the Preference in a PreferenceActivity screen when the CheckBoxPreference is unchecked. If separate on/off summaries are not needed, the summary attribute can be used instead.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

android:summaryOn

android:summaryOn
The summary for the Preference in a PreferenceActivity screen when the CheckBoxPreference is checked. If separate on/off summaries are not needed, the summary attribute can be used instead.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

Public constructors

CheckBoxPreference

Added in API level 1
CheckBoxPreference(context: Context!)

CheckBoxPreference

Added in API level 1
CheckBoxPreference(
    context: Context!,
    attrs: AttributeSet!)

CheckBoxPreference

Added in API level 1
CheckBoxPreference(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

CheckBoxPreference

Added in API level 21
CheckBoxPreference(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Protected methods

onBindView

Added in API level 1
protected open fun onBindView(view: View!): Unit

Deprecated: Deprecated in Java.

Binds the created View to the data for this Preference.

This is a good place to grab references to custom Views in the layout and set properties on them.

Make sure to call through to the superclass's implementation.
If you override this method you must call through to the superclass implementation.

Parameters
view View!: The View that shows this Preference.