Hai dudes,Cany有谁告诉我如何在Android中创建ProgressDialog?
如果这有助于您,请参阅以下代码..
//progress bar
final ProgressDialog progress_dialog = new ProgressDialog(DialogboxExample.this);
progress_dialog.setMessage("Loading please wait..");
progress_dialog.setCancelable(true);
Button btnprogress = (Button) findViewById(R.id.button3);
btnprogress.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
progress_dialog.show();
}
});
//progress bar percentage wise
final ProgressDialog progress_dialog2;
progress_dialog2 = new ProgressDialog(this);
progress_dialog2.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress_dialog2.setMessage("Loeading..");
progress_dialog2.incrementProgressBy(10);
//progress_dialog2.setProgress(100);
progress_dialog2.setCancelable(true);
Button btnprogress2 = (Button) findViewById(R.id.button4);
btnprogress2.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{ progress_dialog2.show();}
});
Run Code Online (Sandbox Code Playgroud)
来吧先试试吧!http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog