我试图在我的配置下载后隐藏StackLayout
调用InfoStackLayout
,显示 5s 的信息标签,但是在隐藏Infostack
在代码中之后,我Grid
的 inContentPage
不会刷新视图并留下空白空间。(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>
</Grid>
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;
});