如何在Xamarin.Forms中显示加载消息

时间:2015-09-03 04:32:04

标签: xaml xamarin.forms

我是Xamarin.Forms的新手,我需要加载消息,如何显示加载消息,请帮帮我

代码: -

<AbsoluteLayout>
  <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
  AbsoluteLayout.LayoutFlags="All" Padding="30" >
  <Grid>
   //something
  </Grid>
  </StackLayout>
  <ContentView x:Name="overlay" AbsoluteLayout.LayoutBounds="0, 0, 1, 1"  AbsoluteLayout.LayoutFlags="All" IsVisible="False" BackgroundColor="#C0808080" Padding="10, 0">
    <ActivityIndicator  WidthRequest="110" HeightRequest="70" IsRunning="True" IsVisible="True" Color="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
  </ContentView>
</AbsoluteLayout>

Thanx In Advance

干杯

2 个答案:

答案 0 :(得分:6)

为ContentView设置IsVisible="True"将显示ActivityIndi​​cator。

<ContentView x:Name="overlay" AbsoluteLayout.LayoutBounds="0, 0, 1, 1"  AbsoluteLayout.LayoutFlags="All" IsVisible="True" BackgroundColor="#C0808080" Padding="10, 0">
    <ActivityIndicator  WidthRequest="110" HeightRequest="70" IsRunning="True" IsVisible="True" Color="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
  </ContentView>

答案 1 :(得分:1)

如果您正在使用MVVM并想要完整模态加载消息,请查看ACR User Dialogs for Xamarin and Windows。您可以通过nuget安装它。您可以找到示例应用程序here