简体   繁体   中英

Indeterminate progress bar not becoming invisible

Here is the code that instantiate a window with an indeterminate progress bar:

SetContentView(Resource.Layout.Main);
progressbar = FindViewById<ProgressBar>(Resource.Id.ProgressBar_pm);
progressbar.Visibility = ViewStates.Invisible;
somefunc();

and here is how somefunc() looks like:

void somefunc()
{
  progressbar.Visibility = ViewStates.Visible;
  /* Here is some time consuming code*/
  progressbar.Visibility = ViewStates.Invisible
}

The progress bar is visible but it does not became invisible and it became visible after that time consuming process is through. There are some edittext and toast in that time consuming code too.

我通过在另一个线程上运行耗时的代码并在主线程上运行UI东西来解决了此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM