1.效果图
public void click(View view) { final ProgressDialog pdDialog = new ProgressDialog(this); //设置标题 pdDialog.setTitle(""); //设置图标 pdDialog.setIcon(R.mipmap.ic_launcher); //设置内容 pdDialog.setMessage("数据加载中……"); //返回键不能取消 pdDialog.setCancelable(false); //设置进度条样式 pdDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); pdDialog.setMax(100); pdDialog.show(); new Thread(new Runnable() { @Override public void run() { try { for (int i = 1; i < 150; i++) { Thread.sleep(100); pdDialog.setProgress(i); } pdDialog.dismiss(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }).start(); }