下载配置后,我试图隐藏称为“ InfoStackLayout”的StackLayout,显示5s的信息标签, 但是在代码中隐藏了信息堆栈之后,ContentPage中的网格无法刷新视图并留下空白空间。 (InfoStackLayout是不可见的,但仍保留了空间) 更糟糕的是,“ ButtonsStack”中的按钮无法正确响应单击的事件。 锁定和解锁手机后,一切正常。 你能帮我解决这个问题吗?
<Grid x:Name="RootGrid" VerticalOptions="Fill" RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackLayout x:Name="InfoStackLayout" Grid.Row="0" Orientation="Horizontal">
<Label x:Name="InfoLabel" TextColor="White" HorizontalOptions="StartAndExpand" Font="18" />
<Image x:Name="GetConfig" HorizontalOptions="EndAndExpand" Source="loading.png" HeightRequest="32" WidthRequest="32">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ReloadConfig_Tapped" NumberOfTapsRequired="1"/>
</Image.GestureRecognizers>
</Image>
</StackLayout>
<StackLayout x:Name="ButtonsStack" Grid.Row="1">
</StackLayout>
InfoLabel.Text = "Download Config";
Device.StartTimer(TimeSpan.FromSeconds(5), () =>
{
Task.Factory.StartNew(async () =>
{
await InfoStackLayout.FadeTo(0);
InfoStackLayout.IsVisible = false;
InfoStackLayout.HeightRequest = 0;
});
return false;
});