gpt4 book ai didi

xamarin - 如何确保StackLayout至少为最小高度?

转载 作者:行者123 更新时间:2023-12-04 04:01:53 26 4
gpt4 key购买 nike

我在我的代码中尝试过。

<StackLayout 
HorizontalOptions="FillAndExpand"
Spacing="0"
MinimumHeightRequest="50">
<StackLayout Margin="20, 6, 20, 8"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Spacing="0">
<Label Text="ABC"
HorizontalOptions="Start"
VerticalOptions="StartAndExpand" />
</StackLayout>
</StackLayout>

但是对于像ABC这样的小文字,高度不等于50。是否可以通过某种方法确保高度最小为50?

最佳答案

您可以尝试类似的方法:

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

<StackLayout Grid.Row="0" HeightRequest="50"/>
</Grid>

我正在我的应用程序中做到这一点,并且效果很好。您将 RowDefinition设置为 Auto,那么它将完全适合您的HeightRequest。

关于xamarin - 如何确保StackLayout至少为最小高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52025715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com