How to set Activity Indicator in Xamarin Forms to support the same in Android

I set Activity Indicator in PCl project of my Xamarin Forms project.
In iOS, It is cover all over the screen (Perfect)
But in Android, the screen is shown with very big spinner. This spinner is covering all over the screen.

I want the small spinner in center of the screen with transparent background as like iOS

My code:

    <AbsoluteLayout>
        <ActivityIndicator x:Name="actWebRequest"
                    Color="White"
                    IsVisible="{Binding IsLoading}"
                    IsRunning="{Binding IsLoading}"
                    AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                    AbsoluteLayout.LayoutFlags= "All" 
                    HorizontalOptions="Fill"
                    VerticalOptions="Fill"
                    BackgroundColor="#70383838">
                    </ActivityIndicator>
            </AbsoluteLayout>

Please help me. I am waiting for whole day. Help will be greatly appreciated....!!! :smile:

Posts

  • MGaudetteMGaudette USMember ✭✭
    edited November 2018

    Have you considered adding an additional layout inside of the absolute layout and placing the activity indicator in the center?

    Ex.
    <AbsoluteLayout> <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All" BackgroundColor="#70383838"> <ActivityIndicator x:Name="actWebRequest" Color="White" IsVisible="{Binding IsLoading}" IsRunning="{Binding IsLoading}" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"> </ActivityIndicator> </StackLayout> </AbsoluteLayout>

  • MGaudetteMGaudette USMember ✭✭
    edited November 2018

    Have you considered adding an additional layout inside of your absolute layout and centering the activity indicator inside of it?

    <AbsoluteLayout>
        <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
            AbsoluteLayout.LayoutFlags= "All"
            IsVisible="{Binding IsLoading}"
            BackgroundColor="#70383838" >
                <ActivityIndicator x:Name="actWebRequest"
                    Color="White"
                     IsVisible="{Binding IsLoading}"
                     IsRunning="{Binding IsLoading}"
                     HorizontalOptions="CenterAndExpand"
                     VerticalOptions="CenterAndExpand"/>
        </StackLayout>
    </AbsoluteLayout>
    
Sign In or Register to comment.