Hai dudes, Cany有人告诉我如何在Android中创建ProgressDialog吗?
答案 0 :(得分:7)
如果这对您有帮助,请参阅以下代码..
//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();}
});
答案 1 :(得分:6)