c# - xamarin課程 - 在相對佈局中的中心圖像,並對齊底部xamarin表單



xamarin缺點 (0)

任何人都可以告訴我,我怎麼可以中心的形象,並將其對齊到一個relativelayout底部? 我試圖但我找不到解決方案。 謝謝

正如你所看到的,你需要將底部和中間的黑色圖像對齊,在黃色背景上。

<Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions Height="*">
      <RowDefinition Height="5*"></RowDefinition>
      <RowDefinition Height="5*"></RowDefinition>
    </Grid.RowDefinitions>
    <RelativeLayout Grid.Row="0" Padding="0" BackgroundColor="Red">

    </RelativeLayout>
    <RelativeLayout Grid.Row="1" Padding="0" BackgroundColor="Yellow">
      <StackLayout Orientation="Horizontal" BackgroundColor="#E3E3E3">
        <Image x:Name="backgroundImage" VerticalOptions="End" Aspect="AspectFit"> </Image>
      </StackLayout>
      <Grid Grid.Row="1">
        <!--<Image x:Name="backgroundImage" Aspect="Fill" VerticalOptions="Fill" />-->
        <!--<Image Aspect="Fill" VerticalOptions="End" x:Name="backgroundImage"/>-->

        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="2*"></ColumnDefinition>
          <ColumnDefinition Width="6*"></ColumnDefinition>
          <ColumnDefinition Width="2*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="1*"></RowDefinition>
          <RowDefinition Height="2*"></RowDefinition>
          <RowDefinition Height="2*"></RowDefinition>
          <RowDefinition Height="2*"></RowDefinition>
          <RowDefinition Height="2*"></RowDefinition>
          <RowDefinition Height="2*"></RowDefinition>
        </Grid.RowDefinitions>
        <ActivityIndicator x:Name="loading" Grid.Row="0" Grid.Column="1" IsVisible="false" Color="#008ECC" IsRunning="true" />
        <Label TextColor="#2196F3" Grid.Row="1" Grid.Column="1" Text="" />
        <Entry TextColor="#2196F3" PlaceholderColor="#A9D6FA" FontSize="24" Grid.Row="1" Grid.Column="1" Placeholder="Username" x:Name="UsernameEntry" Text="" />
        <Label TextColor="#2196F3" Grid.Row="2" Grid.Column="1" Text="" />
        <Entry TextColor="#2196F3" PlaceholderColor="#A9D6FA" FontSize="24" Grid.Row="2" Grid.Column="1" Placeholder="Password" IsPassword="True" x:Name="PasswordEntry" Text="" />
        <Button FontSize="22" Grid.Row="3" Grid.Column="1" Text="Accedi"/>
        <Grid Grid.Row="4" Grid.Column="1">
          <Grid.RowDefinitions>
            <RowDefinition Height="1*"></RowDefinition>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="7*"></ColumnDefinition>
            <ColumnDefinition Width="3*"></ColumnDefinition>
          </Grid.ColumnDefinitions>
          <Label TextColor="#2196F3" Text="Ricorda accesso" Grid.Row="0" Grid.Column="0"></Label>
          <Switch Grid.Row="0" Grid.Column="1"></Switch>
        </Grid>
        <Label  Grid.Row="5" Grid.Column="1" TextColor="#2196F3" Text="Hai dimenticato la password?" FontSize="12"></Label>
      </Grid>
    </RelativeLayout>

  </Grid>