我在Lollipop上的ProgressDialog中看不到进度

我在Lollipop上的ProgressDialog中看不到进度

本文介绍了我在Lollipop上的ProgressDialog中看不到进度微调器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

使用ProgressDialog制作应用程序,它在JellyBean上显示正常,但在使用Lollipop进行测试时,我只看到标题和消息,没有进度条。。我正在使用

Making an app using ProgressDialog, and it shows up fine on JellyBean but when testing with Lollipop I only see the title and message, no progress spinner.. I am using

compile 'com.android.support:appcompat-v7:22.2.0'

支持库和AppCompatActivity

Support library and AppCompatActivity

代码为:

 ProgressDialog progressDialog = new ProgressDialog(AddBuddyActivity.this);
 progressDialog.setMessage("Loading...");
 progressDialog.setCancelable(false);
 progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
 progressDialog.show();

您可以看到我在同一主题上发布的另一个问题。

You can see another question I posted on the same topic here.

推荐答案

注意:您可以看到此问题的伪副本。链接中的链接更全面,但是两者具有相同的解决方案。

NOTE: You can see a pseudo-duplicate of this question here. The one in the link is a little more thorough, but both have the same solution.

答案似乎是,如果用户在开发人员选项中关闭了转换功能,您在ProgressDialog中的动画(即Progress Spinner)将不会显示。打开它们并重新启动应用程序,您将看到微调器!

The answer seems to be that if a user has transitions turned off in developer options, your animations in a ProgressDialog (namely the Progress Spinner) will not show. Turn them on and restart the app and you will see the spinner!

一个允许关闭这些设置的动画的解决方案似乎是创建一个自定义对话框,

A solution that would allow for animations with those settings turned off seems to be to make a custom dialog, which admittedly would probably look better than the default ProgressDialog.

而且,作为对试图滥用ProgressDialog的人们的公平警告,请注意开发人员的这些话:

And, as a fair warning to people attempting to abuse the ProgressDialog, heed these words from the developer documentation:

据此,我认为将它们用于网络上的长途通话是可以的,同时应指示加载信息或进行长时间的本地处理使用其他进度组件之一。

From this, I take that using them for long calls over the network are OK, while loading information or doing a long local process should be indicated using one of the other progress components.

这篇关于我在Lollipop上的ProgressDialog中看不到进度微调器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:35