Most visited

Recently visited

Added in API level 1

ProgressDialog

public class ProgressDialog
extends AlertDialog

java.lang.Object
   ↳ android.app.Dialog
     ↳ android.app.AlertDialog
       ↳ android.app.ProgressDialog


显示进度指示器和可选文字信息或视图的对话框。 只能同时使用短信或视图。

对话框可以在后退键上取消。

进度范围是0..10000。

Summary

Constants

int STYLE_HORIZONTAL

使用水平进度条创建ProgressDialog。

int STYLE_SPINNER

使用循环旋转进度条创建ProgressDialog。

Inherited constants

From class android.app.AlertDialog
From interface android.content.DialogInterface

Public constructors

ProgressDialog(Context context)
ProgressDialog(Context context, int theme)

Public methods

int getMax()
int getProgress()
int getSecondaryProgress()
void incrementProgressBy(int diff)
void incrementSecondaryProgressBy(int diff)
boolean isIndeterminate()
void onStart()

当对话开始时调用。

void setIndeterminate(boolean indeterminate)
void setIndeterminateDrawable(Drawable d)
void setMax(int max)
void setMessage(CharSequence message)
void setProgress(int value)
void setProgressDrawable(Drawable d)
void setProgressNumberFormat(String format)

更改显示当前和最大进度单位的小文本的格式。

void setProgressPercentFormat(NumberFormat format)

更改显示进度百分比的小文本的格式。

void setProgressStyle(int style)
void setSecondaryProgress(int secondaryProgress)
static ProgressDialog show(Context context, CharSequence title, CharSequence message)
static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, DialogInterface.OnCancelListener cancelListener)
static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)
static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate)

Protected methods

void onCreate(Bundle savedInstanceState)

onCreate(Bundle)类似,您应该使用此方法初始化对话框,包括调用 setContentView(View)

void onStop()

打电话告诉你,你正在停止。

Inherited methods

From class android.app.AlertDialog
From class android.app.Dialog
From class java.lang.Object
From interface android.content.DialogInterface
From interface android.view.Window.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnCreateContextMenuListener

Constants

STYLE_HORIZONTAL

Added in API level 1
int STYLE_HORIZONTAL

使用水平进度条创建ProgressDialog。

常数值:1(0x00000001)

STYLE_SPINNER

Added in API level 1
int STYLE_SPINNER

使用循环旋转进度条创建ProgressDialog。 这是默认设置。

常量值:0(0x00000000)

Public constructors

ProgressDialog

Added in API level 1
ProgressDialog (Context context)

Parameters
context Context

ProgressDialog

Added in API level 1
ProgressDialog (Context context, 
                int theme)

Parameters
context Context
theme int

Public methods

getMax

Added in API level 1
int getMax ()

Returns
int

getProgress

Added in API level 1
int getProgress ()

Returns
int

getSecondaryProgress

Added in API level 1
int getSecondaryProgress ()

Returns
int

incrementProgressBy

Added in API level 1
void incrementProgressBy (int diff)

Parameters
diff int

incrementSecondaryProgressBy

Added in API level 1
void incrementSecondaryProgressBy (int diff)

Parameters
diff int

isIndeterminate

Added in API level 1
boolean isIndeterminate ()

Returns
boolean

onStart

Added in API level 1
void onStart ()

当对话开始时调用。

setIndeterminate

Added in API level 1
void setIndeterminate (boolean indeterminate)

Parameters
indeterminate boolean

setIndeterminateDrawable

Added in API level 1
void setIndeterminateDrawable (Drawable d)

Parameters
d Drawable

setMax

Added in API level 1
void setMax (int max)

Parameters
max int

setMessage

Added in API level 1
void setMessage (CharSequence message)

Parameters
message CharSequence

setProgress

Added in API level 1
void setProgress (int value)

Parameters
value int

setProgressDrawable

Added in API level 1
void setProgressDrawable (Drawable d)

Parameters
d Drawable

setProgressNumberFormat

Added in API level 11
void setProgressNumberFormat (String format)

更改显示当前和最大进度单位的小文本的格式。 默认值是“%1d /%2d”。 在号码进行过程中不应该被称为。

Parameters
format String: A string passed to String.format(); use "%1d" for the current number and "%2d" for the maximum. If null, nothing will be shown.

setProgressPercentFormat

Added in API level 11
void setProgressPercentFormat (NumberFormat format)

更改显示进度百分比的小文本的格式。 默认值为NumberFormat.getPercentageInstnace().号码过程中不应调用。

Parameters
format NumberFormat: An instance of a NumberFormat to generate the percentage text. If null, nothing will be shown.

setProgressStyle

Added in API level 1
void setProgressStyle (int style)

Parameters
style int

setSecondaryProgress

Added in API level 1
void setSecondaryProgress (int secondaryProgress)

Parameters
secondaryProgress int

show

Added in API level 1
ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message)

Parameters
context Context
title CharSequence
message CharSequence
Returns
ProgressDialog

show

Added in API level 1
ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable, 
                DialogInterface.OnCancelListener cancelListener)

Parameters
context Context
title CharSequence
message CharSequence
indeterminate boolean
cancelable boolean
cancelListener DialogInterface.OnCancelListener
Returns
ProgressDialog

show

Added in API level 1
ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable)

Parameters
context Context
title CharSequence
message CharSequence
indeterminate boolean
cancelable boolean
Returns
ProgressDialog

show

Added in API level 1
ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate)

Parameters
context Context
title CharSequence
message CharSequence
indeterminate boolean
Returns
ProgressDialog

Protected methods

onCreate

Added in API level 1
void onCreate (Bundle savedInstanceState)

onCreate(Bundle)类似,您应该使用此方法初始化对话框,包括调用 setContentView(View)

Parameters
savedInstanceState Bundle: If this dialog is being reinitialized after a the hosting activity was previously shut down, holds the result from the most recent call to onSaveInstanceState(), or null if this is the first time.

onStop

Added in API level 1
void onStop ()

打电话告诉你,你正在停止。

Hooray!