一.创建一个进度条:(一般会在一个Activity中创建一个方法:protected Dialog onCreateDialog(int dialogCategory))
1.progressDialog.setProgress(int start_progress); : 设置进度条的开始进度默认值,一般创建和注销时需清零
2.progressDialog = new progressDialog(this); : 初始化progressDialog
3.progressDialog.setTitle("the title"); : 为progressDialog设置标题
4.progressDialog.setIcon(R.drawable.ic_launcher); : 为progressDialog设置图标
5.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); :为进度条设置显示样式,此进度调味水平方向(android系统自带)
6.progressDialog.setButton(DialogInterface.BUTTON_POSITIVE,"ok",new DialogInterface.onClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
Toast.makeText(getBaseContent(),"ok clicked!",Toast.LENGTH_SHORT).show();
}
}:);
7.progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE,"cancel",new DialogInterface.onClickListener(){
public void onClick(DialogInterface dailog,int whichButton){
Toast.makeText(getBaseContent(),"cancel click!",Toast.LENGTH_SHORT).show();
}
});
8.progressDialog.incrementProgressBy(int step); : 设置进度条的增长步长 & 一般与handler一起使用将send过来的message 响应到界面
9.progressDialog.dismiss(); :注销进度条
二.
1.progressDialog.setProgress(int start_progress); : 设置进度条的开始进度默认值,一般创建和注销时需清零
2.progressDialog = new progressDialog(this); : 初始化progressDialog
3.progressDialog.setTitle("the title"); : 为progressDialog设置标题
4.progressDialog.setIcon(R.drawable.ic_launcher); : 为progressDialog设置图标
5.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); :为进度条设置显示样式,此进度调味水平方向(android系统自带)
6.progressDialog.setButton(DialogInterface.BUTTON_POSITIVE,"ok",new DialogInterface.onClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
Toast.makeText(getBaseContent(),"ok clicked!",Toast.LENGTH_SHORT).show();
}
}:);
7.progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE,"cancel",new DialogInterface.onClickListener(){
public void onClick(DialogInterface dailog,int whichButton){
Toast.makeText(getBaseContent(),"cancel click!",Toast.LENGTH_SHORT).show();
}
});
8.progressDialog.incrementProgressBy(int step); : 设置进度条的增长步长 & 一般与handler一起使用将send过来的message 响应到界面
9.progressDialog.dismiss(); :注销进度条
二.