ProgressDialog现已弃用

时间:2017-08-24 11:03:40

标签: android progressdialog

现在,对于Android O,不推荐使用进度对话框。 这是什么解决方案?

我收到警告。在我的项目中

Warning:(6, 20) 'Progress Dialog' is deprecated. Deprecated in Java
Warning:(72, 43) 'Progress Dialog' is deprecated. Deprecated in Java
Warning:(89, 27) 'Progress Dialog' is deprecated. Deprecated in Java

我没有为同样的问题找到解决方案。

2 个答案:

答案 0 :(得分:2)

根据谷歌:

  

此类在API级别26中已弃用.ProgressDialog是一种模式   对话框,阻止用户与应用程序交互。代替   使用这个类,你应该使用像这样的进度指示器   ProgressBar,可以嵌入到您应用的UI中。或者,   您可以使用通知向用户通知任务的进度。

https://developer.android.com/reference/android/app/ProgressDialog.html

答案 1 :(得分:2)

Custom ProgressBar就是答案。您可以自己编写或使用https://github.com/Q115/DelayedProgressDialog

中的DelayedProgressDialog之类的内容

用法:

DelayedProgressDialog progressDialog = new DelayedProgressDialog();
progressDialog.show(getSupportFragmentManager(), "tag");
相关问题