ActivityIndicator does not show AT ALL

BurtBurt USMember ✭✭

I want to use a ActivityIndicator, basically for asynchronous actions to a server in a MVVM setup. I am trying that for the first time, it just won't go.

Now a lot could be wrong, but even in the SIMPLEST way it does not show AT ALL. I can see space is reserved on screen, but it stays invisible.
<ActivityIndicator Color="Black" IsVisible="True" IsRunning="True" IsEnabled="True" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="25" WidthRequest="25"/>
I have looked around on the web for any explanation or solution. But I gave up.

Is this a bug?

I have got Xamarin, Xamarin.Android
Everything is up to date as far as I know.

Best Answer

  • BurtBurt US ✭✭
    Accepted Answer

    I tested this in an emulator instead of my physical device. After I got Visual Studio Android Emulator working, sort of.

    It showed that my use of ActivityIndicator was right, but there apparently is some bug in Xamarin about this control, at least on my platform (mentioned earlier).

    So I will enter this as a bug.


  • Sumit.SharmaSumit.Sharma INMember ✭✭
    edited February 2017

    I see no problem in your code, but still, try this, this is working for me

    Try to use

    Activity Indicator inside StackLayout

         <StackLayout BackgroundColor="White" HorizontalOptions="FillandExpand" VerticalOptions="FillandExpand">
                            <ActivityIndicator Color="Black"
                VerticalOptions="Center" HorizontalOptions="Center"
  • BurtBurt USMember ✭✭

    Thanks Sumit, for your prompt answer.

    But I have already tried it on various places, including within StackLayout to start with.

  • JohnHardmanJohnHardman GBUniversity mod

    @Burt - Try removing your WidthRequest and HeightRequest.

    Working in C#, I do nothing more than the following, which works fine:

                ActivityIndicator ai = new ActivityIndicator
                    Color = Color.Red,
                    IsRunning = true,
  • BurtBurt USMember ✭✭

    Thanks, but I started WITHOUT the requests.
    Most of the properties you see just got there trying in case they were needed.

  • JohnHardmanJohnHardman GBUniversity mod

    @Burt - What is the version of the NuGet package you are using for Xamarin.Forms? Also, are you using AppCompat for Android?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    IsRunning & IsVisible are actually wired to the same functionality deep in the control. Don't try to play with both.
    In reality the activity indicator is always running and animated.
    When you change "IsRunning" to false the control is actually being hidden for you.

    So take off all those other properties of IsVisisble, IsEnabled, IsActive, IsSomethingElse... Just use IsRunning and bind that to whatever property in your ViewModel or code behind is being used to control if the indicator should be running.

    Me, I keep an IsBusy property on my ViewModel and bind to that.

  • BurtBurt USMember ✭✭

    Thanks Clint. But that is how I started. I just checked again and do not get any further.

  • BurtBurt USMember ✭✭
    edited February 2017

    Hi John, I have Xamarin.Forms There is no update as far as I know.

    Wait a minute, my package source was wrong. There might some other packages worth updating (not Forms).

    Well, that changed a lot, not sure I need it all. It also implicitly got me Xamarin.Forms
    But unfortunately it did not help.

    Thanks anyway John. At least I discovered something wrong.

  • BurtBurt USMember ✭✭
    edited February 2017

    John, I sort of overlooked your AppCompat question.

    I have got that in my packages, and I found a reference in a scaffold style file.

    I have not deliberately done anything with AppCompat myself. I will have to look into it anyway.

    Could it be a problem, or is there a known problem?
    I am testing on Android 5.0 API 21.

  • JohnHardmanJohnHardman GBUniversity mod

    @Burt - If you look in Bugzilla, there are reported issues around ActivityIndicator in association with specific Layout controls.

    Regarding AppCompat - the reason I asked, was that when I first added an ActivityIndicator into my app, I had trouble getting it to appear. I simply cannot remember what the cause was, but it was around the time I moved to using AppCompat, so I was wondering if it might have been that that finally made it appear. Not sure.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai


    Can you upload a small sample that reproduces this issue for you? I'll take a look and see if it's something we should file a bug for.

    Delete the bin, obj and packages folders to reduce the size of the zip.

  • JohnHardmanJohnHardman GBUniversity mod

    @Burt - the other thing you might be hitting is a busy UI thread. I'm not sure if ActivityIndicator has the same problem as IsBusy on the Page, whereby the Busy indicator only does anything if the UI thread is not busy (I logged that as a bug a while ago). As a test, try putting your ActivityIndicator on a page and leaving it there with IsRunning = true, and without overwriting it.

    Because of that IsBusy issue, I moved the majority of my page creation to another task, switching back to the UI thread to set page.Content (and any other bits that also have to be done on the UI thread) on ContentPage.

  • BurtBurt USMember ✭✭

    John Miller, you have a private message with details.

  • BurtBurt USMember ✭✭
    edited February 2017


    I had noticed some issues in Bugzilla. They mostly seemed inappropriate. I have experienced a bit with the UI thread though. So far no good.

    I can imagine influence from themes and AppCompat. I must have a look.

  • BurtBurt USMember ✭✭

    I took his up again. Did not get any further yet.
    Just updated Xamarin.Forms again. Did bot change anything.
    Additional info: I test on physical Android 5.0 API 21, a HTC M8s.

    Anyone a new idea? Or solved a similar sort of problem?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Coincidental timing..
    This other thread shows an ActivityIndicator being used as part of a floating button approach.

  • BurtBurt USMember ✭✭
    Accepted Answer

    I tested this in an emulator instead of my physical device. After I got Visual Studio Android Emulator working, sort of.

    It showed that my use of ActivityIndicator was right, but there apparently is some bug in Xamarin about this control, at least on my platform (mentioned earlier).

    So I will enter this as a bug.

  • SaymonTSaymonT USMember
    edited April 2017

    have You tried this?
    I mean..thru Styles?
    See response by Max Meng, April 2015.

  • SaymonTSaymonT USMember
    edited April 2017

    So, to make it totally clear, here are the steps I have done to make it working on Android >5.0.

    1) Add (from attached file) "progress_bar.axml" to Android Resources->Drawable with following content

    2) Add following lines to file Android Resources->values->styles.xml

    this comes to the APP STYLE to make it working

    and, finally, this is the style


    I hope it helps!
    (Btw: those 666B was not my intention! :smiley: )

  • NMackayNMackay GBInsider, University mod

    We've got live Forms app and the activity indicator works okay from API17 upwards. We're not using material design at the moment though, maybe that's a factor.

    those 666B was not my intention!


  • BurtBurt USMember ✭✭

    Thanks SaymonT,

    It seems interesting and you are pretty confident. But I can't quite follow your story. The links are incorrect and I could not find what you were referring to.

    Could you correct them?

  • RobertDebaultRobertDebault USUniversity ✭✭✭

    If you are using MVVM and xcml try using this. I have the same issue with activity indicator not showing or responding to the IsBusy setting. I finally discovered a way to fix it. I am still not sure of the ramifications of doing this but it works great..
    If you pass the UI to the view controller then set the IsBusy in the view controller the Activity Indicator will respond correctly. So your code would look something like this... I did not include all of the code but this should give you what you need.







    BindingContext = viewModel = new MyPageViewModel(this);

    public MyPage _page;
    MyPageViewModel(MyPage callPage){
    _page = callPage;
    _page.IsBusy = true;
    // do whatever
    _page.IsBusy = false;

  • XamarinMobileDevXamarinMobileDev FRUniversity

    Hello @Burt,

    I have the same issue, the Activity Indicators are not displayed and I m using an HTC One M8 in Mashmallow 6+, you said that you did your test with " Android 5.0 API 21, a HTC M8s." Maybe the problem is with the HTC Device ?

  • van8tkavan8tka RUMember ✭✭

    Hi everybody! I have the same issue, on emulator works fine but on devices doesn't work. I tested on devices with android 4.1.1 work fine, android 5.1 and 6.0 doesn't work! Xamarin Forms

  • SagarPanwalaSagarPanwala USMember ✭✭
    edited January 12

    Hi Guys
    Any one from xamarin confirm this? Even with latest version of VS on Mac and Xamarin Forms it's happening on some devices.

Sign In or Register to comment.