public class Dialog
extends android.app.Dialog
| Modifier and Type | Class and Description |
|---|---|
static class |
Dialog.Builder |
android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnDismissListener, android.content.DialogInterface.OnKeyListener, android.content.DialogInterface.OnMultiChoiceClickListener, android.content.DialogInterface.OnShowListener| Modifier and Type | Field and Description |
|---|---|
static int |
ACTION_NEGATIVE
The viewId of negative action button.
|
static int |
ACTION_NEUTRAL
The viewId of neutral action button.
|
static int |
ACTION_POSITIVE
The viewId of positive action button.
|
protected int |
mActionHeight |
protected int |
mActionMinWidth |
protected int |
mActionOuterHeight |
protected int |
mActionOuterPadding |
protected int |
mActionPadding |
protected int |
mContentPadding |
protected int |
mDialogHorizontalPadding |
protected int |
mDialogVerticalPadding |
protected int |
mInAnimationId |
protected Button |
mNegativeAction |
protected Button |
mNeutralAction |
protected int |
mOutAnimationId |
protected Button |
mPositiveAction |
protected TextView |
mTitle |
static int |
TITLE
The viewId of title view.
|
| Constructor and Description |
|---|
Dialog(android.content.Context context) |
Dialog(android.content.Context context,
int style) |
| Modifier and Type | Method and Description |
|---|---|
Dialog |
actionBackground(android.graphics.drawable.Drawable drawable)
Set the background drawable of all action buttons.
|
Dialog |
actionBackground(int id)
Set the background drawable of all action buttons.
|
Dialog |
actionRipple(int resId)
Set the RippleEffect of all action buttons.
|
Dialog |
actionTextAppearance(int resId)
Sets the text color, size, style of all action buttons from the specified TextAppearance resource.
|
Dialog |
actionTextColor(android.content.res.ColorStateList color)
Sets the text color of all action buttons.
|
Dialog |
actionTextColor(int color)
Sets the text color of all action buttons.
|
void |
addContentView(android.view.View view,
android.view.ViewGroup.LayoutParams params) |
Dialog |
applyStyle(int resId) |
Dialog |
backgroundColor(int color)
Set the background color of this Dialog
|
Dialog |
cancelable(boolean cancelable)
Sets whether this dialog is cancelable with the
BACK key. |
Dialog |
canceledOnTouchOutside(boolean cancel)
Sets whether this dialog is canceled when touched outside the window's
bounds.
|
Dialog |
clearContent()
Clear the content of this Dialog.
|
Dialog |
contentMargin(int margin)
Set the margin between content view and Dialog border.
|
Dialog |
contentMargin(int left,
int top,
int right,
int bottom)
Set the margin between content view and Dialog border.
|
Dialog |
contentView(int layoutId)
Set the content view of this Dialog.
|
Dialog |
contentView(android.view.View v)
Set the content view of this Dialog.
|
Dialog |
cornerRadius(float radius)
Set the corner radius of this Dialog.
|
Dialog |
dimAmount(float amount)
Set the dim amount of the region outside this Dialog.
|
void |
dismiss() |
void |
dismissImmediately()
Dismiss Dialog immediately without showing out animation.
|
Dialog |
dividerColor(int color)
Set the divider's color of this Dialog.
|
Dialog |
dividerHeight(int height)
Set the height of divider of this Dialog.
|
Dialog |
elevation(float elevation)
Set the elevation value of this Dialog.
|
Dialog |
inAnimation(int resId)
Set the animation when Dialog enter the screen.
|
Dialog |
layoutDirection(int direction)
Set the layout direction of this Dialog
|
Dialog |
layoutParams(int width,
int height)
Set the params of this Dialog layout.
|
Dialog |
maxElevation(float elevation)
Set the maximum elevation value of this Dialog.
|
Dialog |
maxHeight(int height)
Set the maximum height of this Dialog layout.
|
Dialog |
maxWidth(int width)
Set the maximum width of this Dialog layout.
|
Dialog |
negativeAction(java.lang.CharSequence action)
Set the text of negative action button.
|
Dialog |
negativeAction(int id)
Set the text of negative action button.
|
Dialog |
negativeActionBackground(android.graphics.drawable.Drawable drawable)
Set the background drawable of negative action button.
|
Dialog |
negativeActionBackground(int id)
Set the background drawable of neagtive action button.
|
Dialog |
negativeActionClickListener(android.view.View.OnClickListener listener)
Set a listener will be called when negative action button is clicked.
|
Dialog |
negativeActionRipple(int resId)
Set the RippleEffect of negative action button.
|
Dialog |
negativeActionTextAppearance(int resId)
Sets the text color, size, style of negative action button from the specified TextAppearance resource.
|
Dialog |
negativeActionTextColor(android.content.res.ColorStateList color)
Sets the text color of negative action button.
|
Dialog |
negativeActionTextColor(int color)
Sets the text color of negative action button.
|
Dialog |
neutralAction(java.lang.CharSequence action)
Set the text of neutral action button.
|
Dialog |
neutralAction(int id)
Set the text of neutral action button.
|
Dialog |
neutralActionBackground(android.graphics.drawable.Drawable drawable)
Set the background drawable of neutral action button.
|
Dialog |
neutralActionBackground(int id)
Set the background drawable of neutral action button.
|
Dialog |
neutralActionClickListener(android.view.View.OnClickListener listener)
Set a listener will be called when neutral action button is clicked.
|
Dialog |
neutralActionRipple(int resId)
Set the RippleEffect of neutral action button.
|
Dialog |
neutralActionTextAppearance(int resId)
Sets the text color, size, style of neutral action button from the specified TextAppearance resource.
|
Dialog |
neutralActionTextColor(android.content.res.ColorStateList color)
Sets the text color of neutral action button.
|
Dialog |
neutralActionTextColor(int color)
Sets the text color of neutral action button.
|
protected void |
onCreate() |
protected void |
onStart() |
Dialog |
outAnimation(int resId)
Set the animation when Dialog exit the screen.
|
Dialog |
positiveAction(java.lang.CharSequence action)
Set the text of positive action button.
|
Dialog |
positiveAction(int id)
Set the text of positive action button.
|
Dialog |
positiveActionBackground(android.graphics.drawable.Drawable drawable)
Set the background drawable of positive action button.
|
Dialog |
positiveActionBackground(int id)
Set the background drawable of positive action button.
|
Dialog |
positiveActionClickListener(android.view.View.OnClickListener listener)
Set a listener will be called when positive action button is clicked.
|
Dialog |
positiveActionRipple(int resId)
Set the RippleEffect of positive action button.
|
Dialog |
positiveActionTextAppearance(int resId)
Sets the text color, size, style of positive action button from the specified TextAppearance resource.
|
Dialog |
positiveActionTextColor(android.content.res.ColorStateList color)
Sets the text color of positive action button.
|
Dialog |
positiveActionTextColor(int color)
Sets the text color of positive action button.
|
void |
setCancelable(boolean flag) |
void |
setCanceledOnTouchOutside(boolean cancel) |
void |
setContentView(int layoutId) |
void |
setContentView(android.view.View v) |
void |
setContentView(android.view.View v,
android.view.ViewGroup.LayoutParams params) |
void |
setTitle(java.lang.CharSequence title) |
void |
setTitle(int titleId) |
Dialog |
showDivider(boolean show)
Indicate that Dialog should show divider when the content is longer than container view.
|
Dialog |
title(java.lang.CharSequence title)
Set the title of this Dialog.
|
Dialog |
title(int id)
Set the title of this Dialog.
|
Dialog |
titleColor(int color)
Set the text's color of Dialog's title.
|
Dialog |
titleTextAppearance(int resId)
Sets the text color, size, style of the title view from the specified TextAppearance resource.
|
cancel, closeOptionsMenu, create, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getVolumeControlStream, getWindow, hide, invalidateOptionsMenu, isShowing, onActionModeFinished, onActionModeStarted, onAttachedToWindow, onBackPressed, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onStop, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelMessage, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOnShowListener, setOwnerActivity, setVolumeControlStream, show, takeKeyEvents, unregisterForContextMenuprotected TextView mTitle
protected Button mPositiveAction
protected Button mNegativeAction
protected Button mNeutralAction
protected int mContentPadding
protected int mActionHeight
protected int mActionOuterHeight
protected int mActionOuterPadding
protected int mActionMinWidth
protected int mActionPadding
protected int mDialogHorizontalPadding
protected int mDialogVerticalPadding
protected int mInAnimationId
protected int mOutAnimationId
public static final int TITLE
public static final int ACTION_POSITIVE
public static final int ACTION_NEGATIVE
public static final int ACTION_NEUTRAL
public Dialog(android.content.Context context)
public Dialog(android.content.Context context,
int style)
protected void onCreate()
public Dialog applyStyle(int resId)
public Dialog clearContent()
public Dialog layoutParams(int width, int height)
width - The width param. Can be the size in pixels, or ViewGroup.LayoutParams.WRAP_CONTENT or ViewGroup.LayoutParams.MATCH_PARENT.height - The height param. Can be the size in pixels, or ViewGroup.LayoutParams.WRAP_CONTENT or ViewGroup.LayoutParams.MATCH_PARENT.public Dialog maxWidth(int width)
width - The maximum width in pixels.public Dialog maxHeight(int height)
height - The maximum height in pixels.public Dialog dimAmount(float amount)
amount - The dim amount in [0..1].public Dialog backgroundColor(int color)
color - The color value.public Dialog elevation(float elevation)
elevation - public Dialog maxElevation(float elevation)
elevation - public Dialog cornerRadius(float radius)
radius - The corner radius.public Dialog dividerColor(int color)
color - The color value.public Dialog dividerHeight(int height)
height - The size value in pixels.public Dialog title(java.lang.CharSequence title)
title - The title text.public Dialog title(int id)
id - The resourceId of text.public void setTitle(java.lang.CharSequence title)
setTitle in class android.app.Dialogpublic void setTitle(int titleId)
setTitle in class android.app.Dialogpublic Dialog titleColor(int color)
color - The color value.public Dialog titleTextAppearance(int resId)
resId - The resourceId value.public Dialog actionBackground(int id)
id - The resourceId of drawable.public Dialog actionBackground(android.graphics.drawable.Drawable drawable)
drawable - The background drawable.public Dialog actionRipple(int resId)
resId - The resourceId of style.public Dialog actionTextAppearance(int resId)
resId - The resourceId value.public Dialog actionTextColor(android.content.res.ColorStateList color)
color - public Dialog actionTextColor(int color)
color - public Dialog positiveAction(java.lang.CharSequence action)
action - public Dialog positiveAction(int id)
id - The resourceId of text.public Dialog positiveActionBackground(android.graphics.drawable.Drawable drawable)
drawable - The background drawable.public Dialog positiveActionBackground(int id)
id - The resourceId of drawable.public Dialog positiveActionRipple(int resId)
resId - The resourceId of style.public Dialog positiveActionTextAppearance(int resId)
resId - The resourceId value.public Dialog positiveActionTextColor(android.content.res.ColorStateList color)
color - public Dialog positiveActionTextColor(int color)
color - public Dialog positiveActionClickListener(android.view.View.OnClickListener listener)
listener - The View.OnClickListener will be called.public Dialog negativeAction(java.lang.CharSequence action)
action - public Dialog negativeAction(int id)
id - The resourceId of text.public Dialog negativeActionBackground(android.graphics.drawable.Drawable drawable)
drawable - The background drawable.public Dialog negativeActionBackground(int id)
id - The resourceId of drawable.public Dialog negativeActionRipple(int resId)
resId - The resourceId of style.public Dialog negativeActionTextAppearance(int resId)
resId - The resourceId value.public Dialog negativeActionTextColor(android.content.res.ColorStateList color)
color - public Dialog negativeActionTextColor(int color)
color - public Dialog negativeActionClickListener(android.view.View.OnClickListener listener)
listener - The View.OnClickListener will be called.public Dialog neutralAction(java.lang.CharSequence action)
action - public Dialog neutralAction(int id)
id - The resourceId of text.public Dialog neutralActionBackground(android.graphics.drawable.Drawable drawable)
drawable - The background drawable.public Dialog neutralActionBackground(int id)
id - The resourceId of drawable.public Dialog neutralActionRipple(int resId)
resId - The resourceId of style.public Dialog neutralActionTextAppearance(int resId)
resId - The resourceId value.public Dialog neutralActionTextColor(android.content.res.ColorStateList color)
color - public Dialog neutralActionTextColor(int color)
color - public Dialog neutralActionClickListener(android.view.View.OnClickListener listener)
listener - The View.OnClickListener will be called.public Dialog layoutDirection(int direction)
direction - The layout direction value. Can be View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL or View.LAYOUT_DIRECTION_LOCALEpublic Dialog inAnimation(int resId)
resId - The resourceId of animation.public Dialog outAnimation(int resId)
resId - The resourceId of animation.public Dialog showDivider(boolean show)
show - public Dialog contentView(android.view.View v)
v - The content view.public Dialog contentView(int layoutId)
layoutId - The reourceId of layout.public Dialog cancelable(boolean cancelable)
BACK key.public Dialog canceledOnTouchOutside(boolean cancel)
cancel - Whether the dialog should be canceled when touched outsidepublic Dialog contentMargin(int margin)
margin - The margin size in pixels.public Dialog contentMargin(int left, int top, int right, int bottom)
left - The left margin size in pixels.top - The top margin size in pixels.right - The right margin size in pixels.bottom - The bottom margin size in pixels.public void setCancelable(boolean flag)
setCancelable in class android.app.Dialogpublic void setCanceledOnTouchOutside(boolean cancel)
setCanceledOnTouchOutside in class android.app.Dialogpublic void setContentView(android.view.View v)
setContentView in class android.app.Dialogpublic void setContentView(int layoutId)
setContentView in class android.app.Dialogpublic void setContentView(android.view.View v,
android.view.ViewGroup.LayoutParams params)
setContentView in class android.app.Dialogpublic void addContentView(android.view.View view,
android.view.ViewGroup.LayoutParams params)
addContentView in class android.app.Dialogprotected void onStart()
onStart in class android.app.Dialogpublic void dismissImmediately()
public void dismiss()
dismiss in interface android.content.DialogInterfacedismiss in class android.app.Dialog