//进度条通知
public void progress(View view){
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);//进度条样式ProgressDialog.STYLE_SPINNER转圈的那种
dialog.setTitle("下载中");
dialog.setMessage("请稍后..");
dialog.setCancelable(true);
dialog.setMax(100);
dialog.show();
new Thread(){
public void run() {
for(int i=0;i<=100;i++){
dialog.setProgress(i);//设置进度条当前进度
try {
Thread.sleep(30);//每隔30毫秒设置进度条当前进度
} catch (InterruptedException e) {
e.printStackTrace();
}
}
dialog.dismiss();//关闭对话框
};
}.start();
}
Android通知之进度条对话框通知
最新推荐文章于 2019-10-31 16:28:51 发布