ActivityIndi​​cator没有进入正确的位置

时间:2015-08-12 05:53:28

标签: c# xaml xamarin.forms

请帮助我如何将activityIndi​​cator置于正确的位置。     在所有平台中,它没有进入正确的位置,它位于设备的中心而不是顶部。

<ScrollView>
        <Grid BackgroundColor="#3F51B5">
            <Grid.RowDefinitions>
              <RowDefinition Height="auto"></RowDefinition>
              <RowDefinition Height="auto"></RowDefinition>
              <RowDefinition Height="auto"></RowDefinition>
              <RowDefinition Height="auto"></RowDefinition>
            </Grid.RowDefinitions>

            <StackLayout Padding="20" Grid.Column="0" Grid.Row="0"  >
              <Image Source="panel.jpg"/>
            </StackLayout>
            <StackLayout Padding="20" Grid.Column="0" Grid.Row="1">
              <Entry />
            </StackLayout>
            <StackLayout Padding="20" Grid.Column="0" Grid.Row="2">
              <Entry />
            </StackLayout>
            <StackLayout  Padding="20" HorizontalOptions="FillAndExpand" Grid.Column="0" Grid.Row="3">
              <Label/>
            </StackLayout>
            <ActivityIndicator x:Name ="LoadingLogin" IsRunning="False" IsVisible="False" Color="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>

        </Grid>
    </ScrollView>

Thanx提前

1 个答案:

答案 0 :(得分:1)

要在屏幕中心放置ActivityIndicator,您必须将其包含在ContentView内,如下所示:

<ContentView HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" IsVisible="true">
     <ActivityIndicator x:Name ="LoadingLogin" IsRunning="False" IsVisible="False" Color="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
</ContentView>

在显示IsVisible=false时,不要忘记所有其他观看次数应为ActivityIndicator