SetProgressBarIndeterminateVisibility缺乏了解 [英] SetProgressBarIndeterminateVisibility lack of understanding

查看:170
本文介绍了SetProgressBarIndeterminateVisibility缺乏了解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的主要活动则显示为要求这样的进度对话框预计:

If I request a progress dialog like this in my main Activity then it is displayed as expected:

          requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);  
  setProgressBarIndeterminateVisibility(true); 

但是,如果我设置的知名度,假,然后重新设置为真中,我想部署它调用的过程里,什么也不显示。移动requestWindowFeature给该过程导致异常。我应该怎么做呢?

But if I set the visibility to "false", and then reset it to "true" inside the called procedure in which I want to deploy it, nothing is displayed. Moving the requestWindowFeature to the procedure causes an exception. How should I be doing this?

推荐答案

您需要调用 requestWindowFeature()只有一次,在的onCreate() ,在打电话之前的setContentView()。然后你可以使用 setProgressBarIndeterminateVisibility(TRUE | FALSE)来显示或隐藏在活动的任何地方的进度指示器(只要它当然是在UI线程上,)。

You need to call requestWindowFeature() only once, in onCreate(), before you call setContentView(). Then you can use setProgressBarIndeterminateVisibility(true|false) to show or hide the progress indicator from anywhere in the activity (as long as it is on the UI thread, of course).

这篇关于SetProgressBarIndeterminateVisibility缺乏了解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆