加载时禁用用户交互

disable user interaction while loading

是否可以在加载时禁用用户交互?在我的应用程序中,当用户输入他的登录信息并按下按钮登录时,我希望加载指示器显示并在加载时禁用所有用户交互,包括禁用后退 button/gesture,有没有办法实现这一点?任何帮助表示赞赏

看看 https://github.com/redth-org/BTProgressHUD .

它在屏幕上显示时禁用用户交互,您可以在加载完成后将其关闭。

我通过将我的页面的堆栈布局放在绝对布局下,并在加载叠加层旁边解决了这个问题,如下所示:

<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>

并且在代码中更改 IsBusy 将激活加载叠加层