Udostępnij za pośrednictwem


ListPreference Class

Definition

A Preference that displays a list of entries as a dialog.

[Android.Runtime.Register("android/preference/ListPreference", DoNotGenerateAcw=true)]
public class ListPreference : Android.Preferences.DialogPreference
[<Android.Runtime.Register("android/preference/ListPreference", DoNotGenerateAcw=true)>]
type ListPreference = class
    inherit DialogPreference
Inheritance
Attributes

Remarks

A Preference that displays a list of entries as a dialog.

This preference will store a string into the SharedPreferences. This string will be the value from the #setEntryValues(CharSequence[]) array.

This member is deprecated. Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.

Java documentation for android.preference.ListPreference.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

ListPreference(Context, IAttributeSet, Int32, Int32)
ListPreference(Context, IAttributeSet, Int32)
ListPreference(Context, IAttributeSet)
ListPreference(Context)
ListPreference(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

DefaultOrder

Specify for #setOrder(int) if a specific order is not required.

(Inherited from Preference)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Context

Returns the android.content.Context of this Preference.

(Inherited from Preference)
Dependency

Returns the key of the dependency on this Preference. -or- Sets the key of a Preference that this Preference will depend on.

(Inherited from Preference)
Dialog

Gets the dialog that is shown by this preference.

(Inherited from DialogPreference)
DialogIcon

Returns the icon to be shown on subsequent dialogs. -or- Sets the icon of the dialog.

(Inherited from DialogPreference)
DialogLayoutResource

Returns the layout resource that is used as the content View for subsequent dialogs. -or- Sets the layout resource that is inflated as the View to be shown as the content View of subsequent dialogs.

(Inherited from DialogPreference)
DialogMessage (Inherited from DialogPreference)
DialogMessageFormatted

Returns the message to be shown on subsequent dialogs. -or- Sets the message of the dialog.

(Inherited from DialogPreference)
DialogTitle (Inherited from DialogPreference)
DialogTitleFormatted

Returns the title to be shown on subsequent dialogs. -or- Sets the title of the dialog.

(Inherited from DialogPreference)
Editor

Returns an SharedPreferences.Editor where this Preference can save its value(s).

(Inherited from Preference)
Enabled

Checks whether this Preference should be enabled in the list. -or- Sets whether this Preference is enabled.

(Inherited from Preference)
Entry
EntryFormatted

Returns the entry corresponding to the current value.

Extras

Return the extras Bundle object associated with this preference, creating a new Bundle if there currently isn't one.

(Inherited from Preference)
Fragment

Return the fragment class name associated with this Preference. -or- Sets the class name of a fragment to be shown when this Preference is clicked.

(Inherited from Preference)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasKey

Checks whether this Preference has a valid key.

(Inherited from Preference)
Icon

Returns the icon of this Preference. -or- Sets the icon for this Preference with a Drawable.

(Inherited from Preference)
IconSpaceReserved

Gets whether the space this preference icon view is reserved. -or- Sets whether to reserve the space of this Preference icon view when no icon is provided.

(Inherited from Preference)
Intent

Return the Intent associated with this Preference. -or- Sets an Intent to be used for Context#startActivity(Intent) when this Preference is clicked.

(Inherited from Preference)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Key

Gets the key for this Preference, which is also the key used for storing values into SharedPreferences or PreferenceDataStore. -or- Sets the key for this Preference, which is used as a key to the SharedPreferences or PreferenceDataStore.

(Inherited from Preference)
LayoutResource

Gets the layout resource that will be shown as the View for this Preference. -or- Sets the layout resource that is inflated as the View to be shown for this Preference.

(Inherited from Preference)
NegativeButtonText (Inherited from DialogPreference)
NegativeButtonTextFormatted

Returns the text of the negative button to be shown on subsequent dialogs. -or- Sets the text of the negative button of the dialog.

(Inherited from DialogPreference)
OnPreferenceChangeListener

Returns the callback to be invoked when this Preference is changed by the user (but before the internal state has been updated). -or- Sets the callback to be invoked when this Preference is changed by the user (but before the internal state has been updated).

(Inherited from Preference)
OnPreferenceClickListener

Returns the callback to be invoked when this Preference is clicked. -or- Sets the callback to be invoked when this Preference is clicked.

(Inherited from Preference)
Order

Gets the order of this Preference with respect to other Preference objects on the same level. -or- Sets the order of this Preference with respect to other Preference objects on the same level.

(Inherited from Preference)
Parent

Returns the PreferenceGroup which is this Preference assigned to or null if this preference is not assigned to any group or is a root Preference.

(Inherited from Preference)
PeerReference (Inherited from Object)
Persistent

Checks whether this Preference is persistent. -or- Sets whether this Preference is persistent.

(Inherited from Preference)
PositiveButtonText (Inherited from DialogPreference)
PositiveButtonTextFormatted

Returns the text of the positive button to be shown on subsequent dialogs. -or- Sets the text of the positive button of the dialog.

(Inherited from DialogPreference)
PreferenceDataStore

Returns PreferenceDataStore used by this Preference. -or- Sets a PreferenceDataStore to be used by this Preference instead of using android.content.SharedPreferences.

(Inherited from Preference)
PreferenceManager

Gets the PreferenceManager that manages this Preference object's tree.

(Inherited from Preference)
RecycleEnabled

Checks whether this Preference has enabled to have its view recycled when used in the list view. -or- Sets whether this Preference has enabled to have its view recycled when used in the list view.

(Inherited from Preference)
Selectable

Checks whether this Preference should be selectable in the list. -or- Sets whether this Preference is selectable.

(Inherited from Preference)
SharedPreferences

Returns the SharedPreferences where this Preference can read its value(s).

(Inherited from Preference)
ShouldDisableView

Checks whether this Preference should disable its view when it's action is disabled. -or- Sets whether this Preference should disable its view when it gets disabled.

(Inherited from Preference)
SingleLineTitle

Gets whether the title of this preference is constrained to a single line. -or- Sets whether to constrain the title of this Preference to a single line instead of letting it wrap onto multiple lines.

(Inherited from Preference)
Summary (Inherited from Preference)
SummaryFormatted

Returns the summary of this Preference. -or- Sets the summary for this Preference with a CharSequence.

(Inherited from Preference)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Title (Inherited from Preference)
TitleFormatted

Returns the title of this Preference. -or- Sets the title for this Preference with a CharSequence.

(Inherited from Preference)
TitleRes

Returns the title resource ID of this Preference.

(Inherited from Preference)
Value

Returns the value of the key. -or- Sets the value of the key.

WidgetLayoutResource

Gets the layout resource for the controllable widget portion of this Preference. -or- Sets the layout for the controllable widget portion of this Preference.

(Inherited from Preference)

Methods

CallChangeListener(Object)

Call this method after the user changes the preference, but before the internal state is set.

(Inherited from Preference)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CompareTo(Preference)

Compares Preference objects based on order (if set), otherwise alphabetically on the titles.

(Inherited from Preference)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FindIndexOfValue(String)

Returns the index of the given value (in the entry values array).

FindPreferenceInHierarchy(String)

Finds a Preference in this hierarchy (the whole thing, even above/below your PreferenceScreen screen break) with the given key.

(Inherited from Preference)
GetEntries()

The list of entries to be shown in the list in subsequent dialogs.

GetEntriesFormatted()

The list of entries to be shown in the list in subsequent dialogs.

GetEntryValues()

Returns the array of values to be saved for the preference.

GetEntryValuesFormatted()

Returns the array of values to be saved for the preference.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetPersistedBoolean(Boolean)

Attempts to get a persisted boolean if this Preference is persistent.

(Inherited from Preference)
GetPersistedFloat(Single)

Attempts to get a persisted float if this Preference is persistent.

(Inherited from Preference)
GetPersistedInt(Int32)

Attempts to get a persisted int if this Preference is persistent.

(Inherited from Preference)
GetPersistedLong(Int64)

Attempts to get a persisted long if this Preference is persistent.

(Inherited from Preference)
GetPersistedString(String)

Attempts to get a persisted String if this Preference is persistent.

(Inherited from Preference)
GetPersistedStringSet(ICollection<String>)

Attempts to get a persisted set of Strings if this Preference is persistent.

(Inherited from Preference)
GetView(View, ViewGroup)

Gets the View that will be shown in the PreferenceActivity.

(Inherited from Preference)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
NotifyChanged()

Should be called when the data of this Preference has changed.

(Inherited from Preference)
NotifyDependencyChange(Boolean)

Notifies any listening dependents of a change that affects the dependency.

(Inherited from Preference)
NotifyHierarchyChanged()

Should be called when a Preference has been added/removed from this group, or the ordering should be re-evaluated.

(Inherited from Preference)
OnActivityDestroy()

To be added

(Inherited from DialogPreference)
OnAttachedToActivity()

Called when the Preference hierarchy has been attached to the PreferenceActivity.

(Inherited from Preference)
OnAttachedToHierarchy(PreferenceManager)

Called when this Preference has been attached to a Preference hierarchy.

(Inherited from Preference)
OnBindDialogView(View)

Binds views in the content View of the dialog to data.

(Inherited from DialogPreference)
OnBindView(View)

Binds the created View to the data for this Preference.

(Inherited from Preference)
OnClick()

Processes a click on the preference.

(Inherited from Preference)
OnClick(IDialogInterface, Int32)

This method will be invoked when a button in the dialog is clicked.

(Inherited from DialogPreference)
OnCreateDialogView()

Creates the content view for the dialog (if a custom content view is required).

(Inherited from DialogPreference)
OnCreateView(ViewGroup)

Creates the View to be shown for this Preference in the PreferenceActivity.

(Inherited from Preference)
OnDependencyChanged(Preference, Boolean)

Called when the dependency changes.

(Inherited from Preference)
OnDialogClosed(Boolean)

Called when the dialog is dismissed and should be used to save data to the SharedPreferences.

(Inherited from DialogPreference)
OnDismiss(IDialogInterface)

This method will be invoked when the dialog is dismissed.

(Inherited from DialogPreference)
OnGetDefaultValue(TypedArray, Int32)

Called when a Preference is being inflated and the default value attribute needs to be read.

(Inherited from Preference)
OnParentChanged(Preference, Boolean)

Called when the implicit parent dependency changes.

(Inherited from Preference)
OnPrepareDialogBuilder(AlertDialog+Builder)

Prepares the dialog builder to be shown when the preference is clicked.

(Inherited from DialogPreference)
OnPrepareForRemoval()

Called when this Preference is being removed from the hierarchy.

(Inherited from Preference)
OnRestoreInstanceState(IParcelable)

Hook allowing a Preference to re-apply a representation of its internal state that had previously been generated by #onSaveInstanceState.

(Inherited from Preference)
OnSaveInstanceState()

Hook allowing a Preference to generate a representation of its internal state that can later be used to create a new instance with that same state.

(Inherited from Preference)
OnSetInitialValue(Boolean, Object)

Implement this to set the initial value of the Preference.

(Inherited from Preference)
PeekExtras()

Return the extras Bundle object associated with this preference, returning null if there is not currently one.

(Inherited from Preference)
PersistBoolean(Boolean)

Attempts to persist a boolean if this Preference is persistent.

(Inherited from Preference)
PersistFloat(Single)

Attempts to persist a long if this Preference is persistent.

(Inherited from Preference)
PersistInt(Int32)

Attempts to persist an int if this Preference is persistent.

(Inherited from Preference)
PersistLong(Int64)

Attempts to persist a long if this Preference is persistent.

(Inherited from Preference)
PersistString(String)

Attempts to persist a String if this Preference is persistent.

(Inherited from Preference)
PersistStringSet(ICollection<String>)

Attempts to persist a set of Strings if this Preference is persistent.

(Inherited from Preference)
RestoreHierarchyState(Bundle)

Restore this Preference hierarchy's previously saved state from the given container.

(Inherited from Preference)
SaveHierarchyState(Bundle)

Store this Preference hierarchy's frozen state into the given container.

(Inherited from Preference)
SetDefaultValue(Object)

Sets the default value for this Preference, which will be set either if persistence is off or persistence is on and the preference is not found in the persistent storage.

(Inherited from Preference)
SetDialogIcon(Int32)

Sets the icon (resource ID) of the dialog.

(Inherited from DialogPreference)
SetDialogMessage(Int32) (Inherited from DialogPreference)
SetDialogTitle(Int32) (Inherited from DialogPreference)
SetEntries(ICharSequence[])

Sets the human-readable entries to be shown in the list.

SetEntries(Int32)
SetEntries(String[])

Sets the human-readable entries to be shown in the list.

SetEntryValues(ICharSequence[])

The array to find the value to save for a preference when an entry from entries is selected.

SetEntryValues(Int32)
SetEntryValues(String[])

The array to find the value to save for a preference when an entry from entries is selected.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetIcon(Int32)

Sets the icon for this Preference with a resource ID.

(Inherited from Preference)
SetNegativeButtonText(Int32) (Inherited from DialogPreference)
SetPositiveButtonText(Int32) (Inherited from DialogPreference)
SetSummary(Int32)

Sets the summary for this Preference with a resource ID.

(Inherited from Preference)
SetTitle(Int32)

Sets the title for this Preference with a resource ID.

(Inherited from Preference)
SetValueIndex(Int32)

Sets the value to the given index from the entry values.

ShouldCommit()

Returns whether the Preference should commit its saved value(s) in #getEditor().

(Inherited from Preference)
ShouldDisableDependents()

Checks whether this preference's dependents should currently be disabled.

(Inherited from Preference)
ShouldPersist()

Checks whether, at the given time this method is called, this Preference should store/restore its value(s) into the SharedPreferences or into PreferenceDataStore if assigned.

(Inherited from Preference)
ShowDialog(Bundle)

Shows the dialog associated with this Preference.

(Inherited from DialogPreference)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Events

PreferenceChange (Inherited from Preference)
PreferenceClick (Inherited from Preference)

Explicit Interface Implementations

IComparable.CompareTo(Object) (Inherited from Preference)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to