Disable Xamarin Form and Show Activity Indicator

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

I have a Xamarin Form which is using Scroll View. I am trying to show a Activity Indicator at the top as I have a ListView in the middle. But when the user scrolls down the loading is not shown. So, I need help in disabling the page and showing loading at some z-index as in a popup.

回答1:

If you want to have an overlay while the screen is loading you can do this.

<Grid>      <ScrollView>        <!-- Insert your page content in here -->     </ScrollView>      <ContentView IsVisible="false" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">          <ActivityIndicator IsRunning="false" />     </ContentView>  </Grid>

When you set your ContentView to IsVisible="true" it will then overlay on top of your page. You can set the background color and opacity on the ContentView if needed to provide a grey out effect.

Or you can use a similar method and have

<Grid>     <Grid.RowDefinitions>         <RowDefinition Height="Auto" />         <RowDefinition Height="*" />     </Grid.RowDefinitions>      <ActivityIndicator Grid.Row="0" />      <ScrollView Grid.Row="1">      </ScrollView> </Grid>

In this way you will have the activity indicator above the scroll view at all times and allow the user to still scroll.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!