OGeek|极客世界-中国程序员成长平台

标题: android - 在 xamarin 表单设计方面需要帮助 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:53
标题: android - 在 xamarin 表单设计方面需要帮助

我正在使用具有 android 和 IOS 项目的可移植 xamarin 表单(跨平台)制作应用程序。

我遇到了设计问题。

下面是我的代码。

<Grid ColumnSpacing="0" RowSpacing="0" >

    <Grid.RowDefinitions >
      <RowDefinition Height="Auto"></RowDefinition>
      <RowDefinition Height="Auto"></RowDefinition>
      <RowDefinition Height="Auto"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>

    <StackLayout Grid.Row="0" Grid.Column="0" Padding="20,30,20,0">
      <StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="FillAndExpand" HeightRequest="30" BackgroundColor="#6E335E" Padding="10,0,10,0" >
        <Label Text="{ Binding CompanyName }" FontSize="18"  HorizontalOptions="Start" VerticalOptions="CenterAndExpand"  HorizontalTextAlignment="Center" TextColor="White" ></Label>

      </StackLayout>
    </StackLayout>

    <StackLayout VerticalOptions="FillAndExpand" Grid.Row="1" HeightRequest="130"  HorizontalOptions="FillAndExpand" Padding="20,0,20,0">
      <Image  Source="{ Binding LogoPath }" VerticalOptions="FillAndExpand"   HorizontalOptions="FillAndExpand" Aspect="AspectFill"></Image>

    </StackLayout>

    <StackLayout Grid.Row="2" Grid.Column="0" Padding="10,0,10,30" VerticalOptions="StartAndExpand" HorizontalOptions="FillAndExpand" >
      <Image  Source="image_bottom.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Aspect="AspectFill"></Image>
    </StackLayout>

  </Grid>

下面是描述我想要设计的图片

enter image description here

请帮我设计问题。

提前感谢



Best Answer-推荐答案


您的 stacklayout 的高度为 130,因此行定义仅扩展到该点。您应该将定义设置为 *,并将网格垂直选项设置为 fillandexpand,以便填充剩余的空间。

<Grid.RowDefinitions >
          <RowDefinition Height="Auto"></RowDefinition>
          <RowDefinition Height="*"></RowDefinition>
          <RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>

关于android - 在 xamarin 表单设计方面需要帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40146968/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4