gpt4 book ai didi

c# - Xamarin XAML 表单的 Stack Layout 布局噩梦

转载 作者:太空狗 更新时间:2023-10-30 00:06:57 24 4
gpt4 key购买 nike

我有以下代码:

  <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Margin="0,10,0,10" BackgroundColor="Green" Padding="5,5,5,5">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Margin="0,0,0,0" BackgroundColor="Blue">
<Label Text="SHOW COMPLETED TASKS" BackgroundColor="Red" Style="{StaticResource lblSubHeading_Black}" />
</StackLayout>
<Switch x:Name="CompletedJobsSwitch" Toggled="CompletedJobsSwitch_Toggled" HorizontalOptions="EndAndExpand" IsToggled="{Binding isOn}" BackgroundColor="Yellow"/>
</StackLayout>

一切都加载正常,但当应用程序加载时显示,但 Switch 不齐平。为什么?真的很烦人,看起来真的很矛盾enter image description here我看过 http://forums.xamarin.com/discussion/21226/how-to-right-align-a-view-inside-a-list-item但这对我不起作用。

有什么想法吗?

最佳答案

使用这个

<Grid BackgroundColor="Green">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Label Text="SHOW COMPLETED TASKS" BackgroundColor="Red" />
<Switch x:Name="CompletedJobsSwitch" BackgroundColor="Yellow" Grid.Column="1" />
</Grid>

关于c# - Xamarin XAML 表单的 Stack Layout 布局噩梦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38346923/

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