Google 致力于为黑人社区推动种族平等。查看具体举措

TwoStatePreference

abstract class TwoStatePreference : Preference
kotlin.Any
   ↳ androidx.preference.Preference
   ↳ androidx.preference.TwoStatePreference

Common base class for preferences that have two selectable states, save a boolean value, and may have dependent preferences that are enabled/disabled based on the current state.

Summary

Inherited constants
Public constructors
<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!)

Public methods
open Boolean

Returns whether dependents are disabled when this preference is on (true) or when this preference is off (false).

open CharSequence!

Returns the summary to be shown when unchecked.

open CharSequence!

Returns the summary to be shown when checked.

open Boolean

Returns the checked state.

open Unit
setChecked(checked: Boolean)

Sets the checked state and saves it.

open Unit
setDisableDependentsState(disableDependentsState: Boolean)

Sets whether dependents are disabled when this preference is on (true) or when this preference is off (false).

open Unit

Sets the summary to be shown when unchecked.

open Unit
setSummaryOff(summaryResId: Int)

open Unit

Sets the summary to be shown when checked.

open Unit
setSummaryOn(summaryResId: Int)

open Boolean

Protected methods
open Unit

open Any!

open Unit

open Parcelable!

open Unit
onSetInitialValue(defaultValue: Any?)

open Unit

Sync a summary holder contained within holder's sub-hierarchy with the correct summary text.

Inherited functions