Your Boii SimBaa
Your Boii SimBaa

Reputation: 23

disable user interaction while loading

is it possible to disable user interaction while loading? in my application, when the user inters his login info and presses a button to login I want a loading indicator to show and to disable all user interaction while its loading including disabling the back button/gesture, is there a way to achieve that? any help is appreciated

Upvotes: 1

Views: 1179

Answers (2)

Your Boii SimBaa
Your Boii SimBaa

Reputation: 23

I solved it by putting the stack layout of my page under an Absolute layout along side a loading overlay that looks like this:

<AbsoluteLayout VerticalOptions="Fill">
    <StackLayout AbsoluteLayout.LayoutFlags="All" 
                 AbsoluteLayout.LayoutBounds="0,0,1,1" 
                 HorizontalOptions="Center" 
                 VerticalOptions="CenterAndExpand">

               //contents of the page....

    </StackLayout>
    <BoxView AbsoluteLayout.LayoutFlags="All" 
             AbsoluteLayout.LayoutBounds="0,0,1,1" 
             BackgroundColor="Transparent" 
             InputTransparent="false" 
             IsVisible="{Binding Path=IsBusy, Source={x:Reference Page}}" />
    <ActivityIndicator IsRunning="{Binding Path=IsBusy, Source={x:Reference Page}}" 
                       AbsoluteLayout.LayoutFlags="PositionProportional" 
                       AbsoluteLayout.LayoutBounds=".5,.5,-1,-1" />
</AbsoluteLayout>

and changing IsBusy in code will activate the loading overlay

Upvotes: 1

ColeX
ColeX

Reputation: 14475

Take a look at https://github.com/redth-org/BTProgressHUD .

It disables user interaction while it shows on screen , you can dismiss it when the loading is finished .

enter image description here

Upvotes: 0

Related Questions