【发布时间】:2025-11-27 05:05:01
【问题描述】:
我正在尝试将设计修复成这样,最后我做到了,但遇到了另一个问题:屏幕尺寸之间的差异,例如平板电脑和小型手机
<ContentPage.Content>
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<RelativeLayout HorizontalOptions="Center" VerticalOptions="Center">
<Image Source="imgBK.png" x:Name="bkimg"></Image>
<Button x:Name="flip" Opacity="0.5" Clicked="flip_ClickedAsync" AnchorX="200"></Button>
<AbsoluteLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Image Source="" x:Name="ximg" HorizontalOptions="Center" VerticalOptions="Center" Aspect="AspectFill" HeightRequest="150" WidthRequest="150"></Image>
<Label Text="{Binding arword}" x:Name="txtar" FontSize="35" TextColor="Black" HorizontalOptions="End" VerticalOptions="End"></Label>
<Label Text="{Binding enword}" x:Name="txten" FontSize="35" TextColor="Black" HorizontalOptions="End" VerticalOptions="End"></Label>
<Label Text="{Binding ensent}" x:Name="txtesnt" FontSize="18" TextColor="DarkGray" HorizontalOptions="End" VerticalOptions="End"></Label>
<Label Text="{Binding arsent}" x:Name="txtasnt" FontSize="18" TextColor="DarkGray" HorizontalOptions="End" VerticalOptions="End"></Label>
</AbsoluteLayout>
</RelativeLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="5*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="bNext" Opacity="0.5" Clicked="bNext_Clicked" Grid.Row="0" Grid.Column="0" HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="100" HeightRequest="200"></Button>
<Button x:Name="bFav" Opacity="0.5" Clicked="bFav_Clicked" Grid.Row="0" Grid.Column="1" HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="100" HeightRequest="200"></Button>
<Button x:Name="bRep" Opacity="0.5" WidthRequest="100" Clicked="bRep_Clicked" Grid.Row="0" Grid.Column="2" HorizontalOptions="Center" VerticalOptions="Center" HeightRequest="200"></Button>
<Button x:Name="bExit" Opacity="0.5" Clicked="bExit_ClickedAsync" Grid.Row="1" Grid.Column="0" WidthRequest="100" HeightRequest="100" HorizontalOptions="End" VerticalOptions="Center"></Button>
<Button x:Name="bBack" Opacity="0.5" Clicked="bBack_Clicked" Grid.Row="1" Grid.Column="2" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start" VerticalOptions="Center"></Button>
</Grid>
</StackLayout>
</ContentPage.Content>
【问题讨论】: