【发布时间】:2021-04-04 10:25:43
【问题描述】:
正如我在附加图像中显示的那样,在连接到服务器并加载图像之前,我的网格行是方形空间,但是当加载图像时,它会改变它的高度并变成矩形。我怎样才能避免它?我想保留方形空间。
我的照片也是方形的。
连接服务器前后 [1]:https://i.stack.imgur.com/lZj6F.png [2]:https://i.stack.imgur.com/ZaKQd.png
代码:
<Image x:Name="imgStation1" Grid.Row="0" Grid.Column="0" BackgroundColor="White" Source="saturday.jpg" Aspect="AspectFill" />
<StackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="StartAndExpand" Spacing="10" Margin="10">
<Label x:Name="lblLiveStation1" Text="" FontSize="Small" TextColor="AntiqueWhite">
<Label.FontFamily>
<OnPlatform
x:TypeArguments="x:String"
Android="gothic.ttf#gothic"
iOS="Optima-Regular" />
</Label.FontFamily>
</Label>
<Label x:Name="lblDescriptionStation1" Text="Loading..." FontSize="Medium" FontAttributes="Bold" TextColor="FloralWhite">
<Label.FontFamily>
<OnPlatform
x:TypeArguments="x:String"
Android="gothic.ttf#gothic"
iOS="Optima-Regular" />
</Label.FontFamily>
</Label>
<Label x:Name="lblTimeStation1" Text="" FontSize="Small" FontAttributes="Bold" TextColor="GhostWhite">
<Label.FontFamily>
<OnPlatform
x:TypeArguments="x:String"
Android="gothic.ttf#gothic"
iOS="Optima-Regular" />
</Label.FontFamily>
</Label>
<ImageButton x:Name="imgPlayPause0" Grid.Row="0" VerticalOptions="End" HorizontalOptions="Start" Source="playlogo.png" BackgroundColor="Transparent" Clicked="imgPlayPause0_Clicked"></ImageButton>
</StackLayout>
</StackLayout>
【问题讨论】: