DialogPreference
abstract class DialogPreference : Preference
EditTextPreference |
A |
ListPreference |
A |
MultiSelectListPreference |
A |
DropDownPreference |
A |
A base class for Preferences that are dialog-based. When clicked, these preferences will open a dialog showing the actual preference controls.
name android:dialogTitle
name android:dialogMessage
name android:dialogIcon
name android:dialogLayout
name android:positiveButtonText
name android:negativeButtonText
Summary
Nested types |
|---|
interface DialogPreference.TargetFragmentInterface for |
Public constructors |
|---|
DialogPreference(context: Context) |
DialogPreference(context: Context, attrs: AttributeSet?) |
DialogPreference(context: Context, attrs: AttributeSet?, defStyleAttr: Int) |
DialogPreference( |
Public functions |
|
|---|---|
Drawable? |
Returns the icon to be shown on subsequent dialogs. |
Int |
Returns the layout resource that is used as the content view for subsequent dialogs. |
CharSequence? |
Returns the message to be shown on subsequent dialogs. |
CharSequence? |
Returns the title to be shown on subsequent dialogs. |
CharSequence? |
Returns the text of the negative button to be shown on subsequent dialogs. |
CharSequence? |
Returns the text of the positive button to be shown on subsequent dialogs. |
Unit |
setDialogIcon(dialogIcon: Drawable?)Sets the icon of the dialog. |
Unit |
setDialogIcon(dialogIconRes: Int)Sets the icon (resource ID) of the dialog. |
Unit |
setDialogLayoutResource(dialogLayoutResId: Int)Sets the layout resource that is inflated as the |
Unit |
setDialogMessage(dialogMessage: CharSequence?)Sets the message of the dialog. |
Unit |
setDialogMessage(dialogMessageResId: Int) |
Unit |
setDialogTitle(dialogTitle: CharSequence?)Sets the title of the dialog. |
Unit |
setDialogTitle(dialogTitleResId: Int) |
Unit |
setNegativeButtonText(negativeButtonText: CharSequence?)Sets the text of the negative button of the dialog. |
Unit |
setNegativeButtonText(negativeButtonTextResId: Int) |
Unit |
setPositiveButtonText(positiveButtonText: CharSequence?)Sets the text of the positive button of the dialog. |
Unit |
setPositiveButtonText(positiveButtonTextResId: Int) |
Inherited Constants |
||
|---|---|---|
|
Inherited functions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
DialogPreference
DialogPreference(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
DialogPreference
DialogPreference(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
)
Public functions
getDialogIcon
fun getDialogIcon(): Drawable?
Returns the icon to be shown on subsequent dialogs.
getDialogLayoutResource
fun getDialogLayoutResource(): Int
Returns the layout resource that is used as the content view for subsequent dialogs.
| Returns | |
|---|---|
Int |
The layout resource |
getDialogMessage
fun getDialogMessage(): CharSequence?
Returns the message to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence? |
The message |
getDialogTitle
fun getDialogTitle(): CharSequence?
Returns the title to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence? |
The title |
getNegativeButtonText
fun getNegativeButtonText(): CharSequence?
Returns the text of the negative button to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence? |
The text of the negative button |
getPositiveButtonText
fun getPositiveButtonText(): CharSequence?
Returns the text of the positive button to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence? |
The text of the positive button |
setDialogIcon
fun setDialogIcon(dialogIcon: Drawable?): Unit
Sets the icon of the dialog. This will be shown on subsequent dialogs.
setDialogIcon
fun setDialogIcon(dialogIconRes: Int): Unit
Sets the icon (resource ID) of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
dialogIconRes: Int |
The icon, as a resource ID |
setDialogLayoutResource
fun setDialogLayoutResource(dialogLayoutResId: Int): Unit
Sets the layout resource that is inflated as the View to be shown as the content view of subsequent dialogs.
| Parameters | |
|---|---|
dialogLayoutResId: Int |
The layout resource ID to be inflated |
| See also | |
|---|---|
setDialogMessage |
setDialogMessage
fun setDialogMessage(dialogMessage: CharSequence?): Unit
Sets the message of the dialog. This will be shown on subsequent dialogs.
This message forms the content view of the dialog and conflicts with list-based dialogs, for example. If setting a custom View on a dialog via setDialogLayoutResource, include a android.widget.TextView with ID message and it will be populated with this message.
| Parameters | |
|---|---|
dialogMessage: CharSequence? |
The message |
setDialogMessage
fun setDialogMessage(dialogMessageResId: Int): Unit
| Parameters | |
|---|---|
dialogMessageResId: Int |
The dialog message as a resource |
| See also | |
|---|---|
setDialogMessage |
setDialogTitle
fun setDialogTitle(dialogTitle: CharSequence?): Unit
Sets the title of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
dialogTitle: CharSequence? |
The title |
setDialogTitle
fun setDialogTitle(dialogTitleResId: Int): Unit
| Parameters | |
|---|---|
dialogTitleResId: Int |
The dialog title as a resource |
| See also | |
|---|---|
setDialogTitle |
setNegativeButtonText
fun setNegativeButtonText(negativeButtonText: CharSequence?): Unit
Sets the text of the negative button of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
negativeButtonText: CharSequence? |
The text of the negative button |
setNegativeButtonText
fun setNegativeButtonText(negativeButtonTextResId: Int): Unit
| Parameters | |
|---|---|
negativeButtonTextResId: Int |
The negative button text as a resource |
| See also | |
|---|---|
setNegativeButtonText |
setPositiveButtonText
fun setPositiveButtonText(positiveButtonText: CharSequence?): Unit
Sets the text of the positive button of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
positiveButtonText: CharSequence? |
The text of the positive button |
setPositiveButtonText
fun setPositiveButtonText(positiveButtonTextResId: Int): Unit
| Parameters | |
|---|---|
positiveButtonTextResId: Int |
The positive button text as a resource |
| See also | |
|---|---|
setPositiveButtonText |
Protected functions
onClick
protected fun onClick(): Unit
Processes a click on the preference. This includes saving the value to the SharedPreferences. However, the overridden method should call callChangeListener to make sure the client wants to update the preference's state with the new value.