如果我在我的主要活动则显示为要求这样的进度对话框预计:
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).