主要函数部分代码:

final ProgressDialog proDialog = android.app.ProgressDialog
.show(MainActivity.this, "测试", "2秒后自动消失!");
Thread thread = new Thread() {
public void run() {
try {
sleep(2000);
} catch (InterruptedException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
proDialog.dismiss();// 万万不可少这句,否则会程序会卡死。
}
};
thread.start();

运行结果如下:

Android中ProgressDialog自动消失

相关文章:

  • 2021-08-19
  • 2022-02-13
  • 2021-12-04
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
猜你喜欢
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
相关资源
相似解决方案