belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1
DropDownPreference
public
class
DropDownPreference
extends ListPreference
| java.lang.Object | ||||
| ↳ | android.support.v7.preference.Preference | |||
| ↳ | android.support.v7.preference.DialogPreference | |||
| ↳ | android.support.v7.preference.ListPreference | |||
| ↳ | android.support.v7.preference.DropDownPreference | |||
A version of ListPreference that presents the options in a
drop down menu rather than a dialog.
Summary
Inherited XML attributes | |
|---|---|
android.support.v7.preference.Preference
| |
Inherited constants |
|---|
android.support.v7.preference.Preference
|
Public constructors | |
|---|---|
DropDownPreference(Context context)
|
|
DropDownPreference(Context context, AttributeSet attrs)
|
|
DropDownPreference(Context context, AttributeSet attrs, int defStyle)
|
|
DropDownPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
|
Public methods | |
|---|---|
void
|
onBindViewHolder(PreferenceViewHolder view)
Binds the created View to the data for this Preference. |
void
|
setEntries(CharSequence[] entries)
Sets the human-readable entries to be shown in the list. |
void
|
setValueIndex(int index)
Sets the value to the given index from the entry values. |
Protected methods | |
|---|---|
ArrayAdapter
|
createAdapter()
By default, this class uses a simple |
void
|
notifyChanged()
Should be called when the data of this |
void
|
onClick()
Processes a click on the preference. |
Inherited methods | |
|---|---|
android.support.v7.preference.ListPreference
| |
android.support.v7.preference.DialogPreference
| |
android.support.v7.preference.Preference
| |
java.lang.Object
| |
java.lang.Comparable
| |
Public constructors
DropDownPreference
DropDownPreference (Context context)
| Parameters | |
|---|---|
context |
Context |
DropDownPreference
DropDownPreference (Context context, AttributeSet attrs)
| Parameters | |
|---|---|
context |
Context |
attrs |
AttributeSet |
DropDownPreference
DropDownPreference (Context context, AttributeSet attrs, int defStyle)
| Parameters | |
|---|---|
context |
Context |
attrs |
AttributeSet |
defStyle |
int |
DropDownPreference
DropDownPreference (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
| Parameters | |
|---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
defStyleRes |
int |
Public methods
onBindViewHolder
void onBindViewHolder (PreferenceViewHolder view)
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 | |
|---|---|
view |
PreferenceViewHolder: 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.
|
setEntries
void setEntries (CharSequence[] entries)
Sets the human-readable entries to be shown in the list. This will be shown in subsequent dialogs.
Each entry must have a corresponding index in
setEntryValues(CharSequence[]).
| Parameters | |
|---|---|
entries |
CharSequence: The entries. |
setValueIndex
void setValueIndex (int index)
Sets the value to the given index from the entry values.
| Parameters | |
|---|---|
index |
int: The index of the value to set.
|
Protected methods
createAdapter
ArrayAdapter createAdapter ()
By default, this class uses a simple ArrayAdapter. But if you need
a more complicated ArrayAdapter, this method can be overridden to
create a custom one.
Note: This method is called from the constructor. So, overridden methods will get called before any subclass initialization.
| Returns | |
|---|---|
ArrayAdapter |
The custom ArrayAdapter that needs to be used with this class.
|
notifyChanged
void notifyChanged ()
Should be called when the data of this Preference has changed.
onClick
void onClick ()
Processes a click on the preference. This includes saving the value to
the SharedPreferences. However, the overridden method should
call callChangeListener(Object) to make sure the client wants to
update the preference's state with the new value.
Interfaces
- DialogPreference.TargetFragment
- Preference.OnPreferenceChangeListener
- Preference.OnPreferenceClickListener
- PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback
- PreferenceFragmentCompat.OnPreferenceStartFragmentCallback
- PreferenceFragmentCompat.OnPreferenceStartScreenCallback
- PreferenceGroup.PreferencePositionCallback
- PreferenceManager.OnDisplayPreferenceDialogListener
- PreferenceManager.OnNavigateToScreenListener
- PreferenceManager.OnPreferenceTreeClickListener
Classes
- CheckBoxPreference
- DialogPreference
- DropDownPreference
- EditTextPreference
- EditTextPreferenceDialogFragmentCompat
- ListPreference
- ListPreferenceDialogFragmentCompat
- MultiSelectListPreferenceDialogFragmentCompat
- Preference
- Preference.BaseSavedState
- PreferenceCategory
- PreferenceDataStore
- PreferenceDialogFragmentCompat
- PreferenceFragmentCompat
- PreferenceGroup
- PreferenceManager
- PreferenceManager.PreferenceComparisonCallback
- PreferenceManager.SimplePreferenceComparisonCallback
- PreferenceScreen
- PreferenceViewHolder
- R
- R.anim
- R.attr
- R.bool
- R.color
- R.dimen
- R.drawable
- R.id
- R.integer
- R.layout
- R.string
- R.style
- R.styleable
- SeekBarPreference
- SwitchPreferenceCompat
- TwoStatePreference