added in version 24.1.0
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1

SwitchPreferenceCompat

public class SwitchPreferenceCompat
extends TwoStatePreference

java.lang.Object
   ↳ android.support.v7.preference.Preference
     ↳ android.support.v7.preference.TwoStatePreference
       ↳ android.support.v7.preference.SwitchPreferenceCompat


A Preference that provides a two-state toggleable option.

This preference will store a boolean into the SharedPreferences.

Summary

Inherited XML attributes

From class android.support.v7.preference.Preference

Inherited constants

From class android.support.v7.preference.Preference

Inherited fields

From class android.support.v7.preference.TwoStatePreference

Public constructors

SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Construct a new SwitchPreference with the given style options.

SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr)

Construct a new SwitchPreference with the given style options.

SwitchPreferenceCompat(Context context, AttributeSet attrs)

Construct a new SwitchPreference with the given style options.

SwitchPreferenceCompat(Context context)

Construct a new SwitchPreference with default style options.

Public methods

CharSequence getSwitchTextOff()
CharSequence getSwitchTextOn()
void onBindViewHolder(PreferenceViewHolder holder)

Binds the created View to the data for this Preference.

void setSwitchTextOff(int resId)

Set the text displayed on the switch widget in the off state.

void setSwitchTextOff(CharSequence offText)

Set the text displayed on the switch widget in the off state.

void setSwitchTextOn(CharSequence onText)

Set the text displayed on the switch widget in the on state.

void setSwitchTextOn(int resId)

Set the text displayed on the switch widget in the on state.

Inherited methods