Android APIs
public class

CheckBoxPreference

extends TwoStatePreference
java.lang.Object
   ↳ android.support.v7.preference.Preference
     ↳ android.support.v7.preference.TwoStatePreference
       ↳ android.support.v7.preference.CheckBoxPreference

Class Overview

A Preference that provides checkbox widget functionality.

This preference will store a boolean into the SharedPreferences.

Summary

XML Attributes
Attribute Name Related Method Description
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. 
[Expand]
Inherited XML Attributes
From class android.support.v7.preference.Preference
[Expand]
Inherited Constants
From class android.support.v7.preference.Preference
[Expand]
Inherited Fields
From class android.support.v7.preference.TwoStatePreference
Public Constructors
CheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr)
CheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
CheckBoxPreference(Context context, AttributeSet attrs)
CheckBoxPreference(Context context)
Public Methods
void onBindViewHolder(PreferenceViewHolder holder)
Binds the created View to the data for this Preference.
[Expand]
Inherited Methods
From class android.support.v7.preference.TwoStatePreference
From class android.support.v7.preference.Preference
From class java.lang.Object
From interface java.lang.Comparable

XML Attributes

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.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol disableDependentsState.

Related Methods

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.

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

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol summaryOff.

Related Methods

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.

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

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol summaryOn.

Related Methods

Public Constructors

public CheckBoxPreference (Context context, AttributeSet attrs, int defStyleAttr)

public CheckBoxPreference (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

public CheckBoxPreference (Context context, AttributeSet attrs)

public CheckBoxPreference (Context context)

Public Methods

public void onBindViewHolder (PreferenceViewHolder holder)

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.

Parameters
holder The ViewHolder that provides references to the views to fill in. These views will be recycled, so you should not hold a reference to them after this method returns.