MaterialAlertDialogBuilder
public
class
MaterialAlertDialogBuilder
extends AlertDialog.Builder
java.lang.Object
|
↳ |
androidx.appcompat.app.AlertDialog.Builder
|
|
↳ |
com.google.android.material.dialog.MaterialAlertDialogBuilder
|
An extension of AlertDialog.Builder
for use with a Material theme (e.g.,
Theme.MaterialComponents).
This Builder must be used in order for AlertDialog objects to respond to color and shape
theming provided by Material themes.
The type of dialog returned is still an AlertDialog
; there is no specific Material
implementation of AlertDialog
.
For more information, see the component
developer guidance and design
guidelines.
Summary
Public methods |
AlertDialog
|
create()
|
Drawable
|
getBackground()
|
MaterialAlertDialogBuilder
|
setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setBackground(Drawable background)
|
MaterialAlertDialogBuilder
|
setBackgroundInsetBottom(int backgroundInsetBottom)
|
MaterialAlertDialogBuilder
|
setBackgroundInsetEnd(int backgroundInsetEnd)
|
MaterialAlertDialogBuilder
|
setBackgroundInsetStart(int backgroundInsetStart)
|
MaterialAlertDialogBuilder
|
setBackgroundInsetTop(int backgroundInsetTop)
|
MaterialAlertDialogBuilder
|
setCancelable(boolean cancelable)
|
MaterialAlertDialogBuilder
|
setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn)
|
MaterialAlertDialogBuilder
|
setCustomTitle(View customTitleView)
|
MaterialAlertDialogBuilder
|
setIcon(Drawable icon)
|
MaterialAlertDialogBuilder
|
setIcon(int iconId)
|
MaterialAlertDialogBuilder
|
setIconAttribute(int attrId)
|
MaterialAlertDialogBuilder
|
setItems(int itemsId, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setItems(CharSequence[] items, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setMessage(int messageId)
|
MaterialAlertDialogBuilder
|
setMessage(CharSequence message)
|
MaterialAlertDialogBuilder
|
setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)
|
MaterialAlertDialogBuilder
|
setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn, DialogInterface.OnMultiChoiceClickListener listener)
|
MaterialAlertDialogBuilder
|
setMultiChoiceItems(int itemsId, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)
|
MaterialAlertDialogBuilder
|
setNegativeButton(CharSequence text, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setNegativeButton(int textId, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setNegativeButtonIcon(Drawable icon)
|
MaterialAlertDialogBuilder
|
setNeutralButton(CharSequence text, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setNeutralButton(int textId, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setNeutralButtonIcon(Drawable icon)
|
MaterialAlertDialogBuilder
|
setOnCancelListener(DialogInterface.OnCancelListener onCancelListener)
|
MaterialAlertDialogBuilder
|
setOnDismissListener(DialogInterface.OnDismissListener onDismissListener)
|
MaterialAlertDialogBuilder
|
setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
|
MaterialAlertDialogBuilder
|
setOnKeyListener(DialogInterface.OnKeyListener onKeyListener)
|
MaterialAlertDialogBuilder
|
setPositiveButton(int textId, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setPositiveButtonIcon(Drawable icon)
|
MaterialAlertDialogBuilder
|
setSingleChoiceItems(int itemsId, int checkedItem, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setSingleChoiceItems(ListAdapter adapter, int checkedItem, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setSingleChoiceItems(Cursor cursor, int checkedItem, String labelColumn, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setSingleChoiceItems(CharSequence[] items, int checkedItem, DialogInterface.OnClickListener listener)
|
MaterialAlertDialogBuilder
|
setTitle(CharSequence title)
|
MaterialAlertDialogBuilder
|
setTitle(int titleId)
|
MaterialAlertDialogBuilder
|
setView(int layoutResId)
|
MaterialAlertDialogBuilder
|
setView(View view)
|
Inherited methods |
From class
androidx.appcompat.app.AlertDialog.Builder
AlertDialog
|
create()
|
Context
|
getContext()
|
AlertDialog.Builder
|
setAdapter(ListAdapter arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setCancelable(boolean arg0)
|
AlertDialog.Builder
|
setCursor(Cursor arg0, DialogInterface.OnClickListener arg1, String arg2)
|
AlertDialog.Builder
|
setCustomTitle(View arg0)
|
AlertDialog.Builder
|
setIcon(Drawable arg0)
|
AlertDialog.Builder
|
setIcon(int arg0)
|
AlertDialog.Builder
|
setIconAttribute(int arg0)
|
AlertDialog.Builder
|
setInverseBackgroundForced(boolean arg0)
|
AlertDialog.Builder
|
setItems(int arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setItems(CharSequence[] arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setMessage(int arg0)
|
AlertDialog.Builder
|
setMessage(CharSequence arg0)
|
AlertDialog.Builder
|
setMultiChoiceItems(CharSequence[] arg0, boolean[] arg1, DialogInterface.OnMultiChoiceClickListener arg2)
|
AlertDialog.Builder
|
setMultiChoiceItems(Cursor arg0, String arg1, String arg2, DialogInterface.OnMultiChoiceClickListener arg3)
|
AlertDialog.Builder
|
setMultiChoiceItems(int arg0, boolean[] arg1, DialogInterface.OnMultiChoiceClickListener arg2)
|
AlertDialog.Builder
|
setNegativeButton(CharSequence arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setNegativeButton(int arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setNegativeButtonIcon(Drawable arg0)
|
AlertDialog.Builder
|
setNeutralButton(CharSequence arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setNeutralButton(int arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setNeutralButtonIcon(Drawable arg0)
|
AlertDialog.Builder
|
setOnCancelListener(DialogInterface.OnCancelListener arg0)
|
AlertDialog.Builder
|
setOnDismissListener(DialogInterface.OnDismissListener arg0)
|
AlertDialog.Builder
|
setOnItemSelectedListener(AdapterView.OnItemSelectedListener arg0)
|
AlertDialog.Builder
|
setOnKeyListener(DialogInterface.OnKeyListener arg0)
|
AlertDialog.Builder
|
setPositiveButton(int arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setPositiveButton(CharSequence arg0, DialogInterface.OnClickListener arg1)
|
AlertDialog.Builder
|
setPositiveButtonIcon(Drawable arg0)
|
AlertDialog.Builder
|
setRecycleOnMeasureEnabled(boolean arg0)
|
AlertDialog.Builder
|
setSingleChoiceItems(int arg0, int arg1, DialogInterface.OnClickListener arg2)
|
AlertDialog.Builder
|
setSingleChoiceItems(ListAdapter arg0, int arg1, DialogInterface.OnClickListener arg2)
|
AlertDialog.Builder
|
setSingleChoiceItems(Cursor arg0, int arg1, String arg2, DialogInterface.OnClickListener arg3)
|
AlertDialog.Builder
|
setSingleChoiceItems(CharSequence[] arg0, int arg1, DialogInterface.OnClickListener arg2)
|
AlertDialog.Builder
|
setTitle(CharSequence arg0)
|
AlertDialog.Builder
|
setTitle(int arg0)
|
AlertDialog.Builder
|
setView(View arg0, int arg1, int arg2, int arg3, int arg4)
|
AlertDialog.Builder
|
setView(int arg0)
|
AlertDialog.Builder
|
setView(View arg0)
|
AlertDialog
|
show()
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
MaterialAlertDialogBuilder
public MaterialAlertDialogBuilder (Context context)
Parameters |
context |
Context |
MaterialAlertDialogBuilder
public MaterialAlertDialogBuilder (Context context,
int overrideThemeResId)
Parameters |
context |
Context |
overrideThemeResId |
int |
Public methods
create
public AlertDialog create ()
getBackground
public Drawable getBackground ()
setAdapter
public MaterialAlertDialogBuilder setAdapter (ListAdapter adapter,
DialogInterface.OnClickListener listener)
Parameters |
adapter |
ListAdapter |
listener |
DialogInterface.OnClickListener |
setBackgroundInsetBottom
public MaterialAlertDialogBuilder setBackgroundInsetBottom (int backgroundInsetBottom)
Parameters |
backgroundInsetBottom |
int |
setBackgroundInsetEnd
public MaterialAlertDialogBuilder setBackgroundInsetEnd (int backgroundInsetEnd)
Parameters |
backgroundInsetEnd |
int |
setBackgroundInsetStart
public MaterialAlertDialogBuilder setBackgroundInsetStart (int backgroundInsetStart)
Parameters |
backgroundInsetStart |
int |
setBackgroundInsetTop
public MaterialAlertDialogBuilder setBackgroundInsetTop (int backgroundInsetTop)
Parameters |
backgroundInsetTop |
int |
setCursor
public MaterialAlertDialogBuilder setCursor (Cursor cursor,
DialogInterface.OnClickListener listener,
String labelColumn)
Parameters |
cursor |
Cursor |
listener |
DialogInterface.OnClickListener |
labelColumn |
String |
setItems
public MaterialAlertDialogBuilder setItems (int itemsId,
DialogInterface.OnClickListener listener)
Parameters |
itemsId |
int |
listener |
DialogInterface.OnClickListener |
setItems
public MaterialAlertDialogBuilder setItems (CharSequence[] items,
DialogInterface.OnClickListener listener)
Parameters |
items |
CharSequence |
listener |
DialogInterface.OnClickListener |
setMultiChoiceItems
public MaterialAlertDialogBuilder setMultiChoiceItems (CharSequence[] items,
boolean[] checkedItems,
DialogInterface.OnMultiChoiceClickListener listener)
Parameters |
items |
CharSequence |
checkedItems |
boolean |
listener |
DialogInterface.OnMultiChoiceClickListener |
setMultiChoiceItems
public MaterialAlertDialogBuilder setMultiChoiceItems (Cursor cursor,
String isCheckedColumn,
String labelColumn,
DialogInterface.OnMultiChoiceClickListener listener)
Parameters |
cursor |
Cursor |
isCheckedColumn |
String |
labelColumn |
String |
listener |
DialogInterface.OnMultiChoiceClickListener |
setMultiChoiceItems
public MaterialAlertDialogBuilder setMultiChoiceItems (int itemsId,
boolean[] checkedItems,
DialogInterface.OnMultiChoiceClickListener listener)
Parameters |
itemsId |
int |
checkedItems |
boolean |
listener |
DialogInterface.OnMultiChoiceClickListener |
setNegativeButton
public MaterialAlertDialogBuilder setNegativeButton (CharSequence text,
DialogInterface.OnClickListener listener)
Parameters |
text |
CharSequence |
listener |
DialogInterface.OnClickListener |
setNegativeButton
public MaterialAlertDialogBuilder setNegativeButton (int textId,
DialogInterface.OnClickListener listener)
Parameters |
textId |
int |
listener |
DialogInterface.OnClickListener |
setNeutralButton
public MaterialAlertDialogBuilder setNeutralButton (CharSequence text,
DialogInterface.OnClickListener listener)
Parameters |
text |
CharSequence |
listener |
DialogInterface.OnClickListener |
setNeutralButton
public MaterialAlertDialogBuilder setNeutralButton (int textId,
DialogInterface.OnClickListener listener)
Parameters |
textId |
int |
listener |
DialogInterface.OnClickListener |
setOnCancelListener
public MaterialAlertDialogBuilder setOnCancelListener (DialogInterface.OnCancelListener onCancelListener)
Parameters |
onCancelListener |
DialogInterface.OnCancelListener |
setOnDismissListener
public MaterialAlertDialogBuilder setOnDismissListener (DialogInterface.OnDismissListener onDismissListener)
Parameters |
onDismissListener |
DialogInterface.OnDismissListener |
public MaterialAlertDialogBuilder setOnItemSelectedListener (AdapterView.OnItemSelectedListener listener)
Parameters |
listener |
AdapterView.OnItemSelectedListener |
setOnKeyListener
public MaterialAlertDialogBuilder setOnKeyListener (DialogInterface.OnKeyListener onKeyListener)
Parameters |
onKeyListener |
DialogInterface.OnKeyListener |
setPositiveButton
public MaterialAlertDialogBuilder setPositiveButton (int textId,
DialogInterface.OnClickListener listener)
Parameters |
textId |
int |
listener |
DialogInterface.OnClickListener |
setPositiveButton
public MaterialAlertDialogBuilder setPositiveButton (CharSequence text,
DialogInterface.OnClickListener listener)
Parameters |
text |
CharSequence |
listener |
DialogInterface.OnClickListener |
setSingleChoiceItems
public MaterialAlertDialogBuilder setSingleChoiceItems (int itemsId,
int checkedItem,
DialogInterface.OnClickListener listener)
Parameters |
itemsId |
int |
checkedItem |
int |
listener |
DialogInterface.OnClickListener |
setSingleChoiceItems
public MaterialAlertDialogBuilder setSingleChoiceItems (ListAdapter adapter,
int checkedItem,
DialogInterface.OnClickListener listener)
Parameters |
adapter |
ListAdapter |
checkedItem |
int |
listener |
DialogInterface.OnClickListener |
setSingleChoiceItems
public MaterialAlertDialogBuilder setSingleChoiceItems (Cursor cursor,
int checkedItem,
String labelColumn,
DialogInterface.OnClickListener listener)
Parameters |
cursor |
Cursor |
checkedItem |
int |
labelColumn |
String |
listener |
DialogInterface.OnClickListener |
setSingleChoiceItems
public MaterialAlertDialogBuilder setSingleChoiceItems (CharSequence[] items,
int checkedItem,
DialogInterface.OnClickListener listener)
Parameters |
items |
CharSequence |
checkedItem |
int |
listener |
DialogInterface.OnClickListener |