Xamarin iOS:如果出现弹出窗口,如何使状态栏变暗

问题描述 投票:0回答:1

我正在更改iOS状态栏颜色及其文本颜色。除了屏幕上显示弹出窗口外,结果看起来都不错。如下图所示,当屏幕上显示弹出窗口时,状态栏不会变暗,似乎在屏幕上显得突出。

由于我真的不熟悉iPhone,它通常以这种方式工作吗?或者,如果出现弹出窗口,是否有任何变通方法来使状态栏变暗?

注意:我在iOS 12.1上使用iPhone X

弹出代码:

<?xml version="1.0" encoding="utf-8" ?>

<pages:BasePopupPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="WhiteLabel.Mobile.App.Pages.Popup.TransferPopUp"
    xmlns:pages="clr-namespace:WhiteLabel.Mobile.App.Pages.Popup"
    xmlns:popups="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
    xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
    xmlns:Resources="clr-namespace:WhiteLabel.Mobile.App.Resources">

    <!--Animations use example-->
    <popups:PopupPage.Animation>
        <animations:ScaleAnimation 
          PositionIn="Center"
          PositionOut="Center"
          ScaleIn="1.2"
          ScaleOut="0.8"
          DurationIn="400"
          DurationOut="300"
          EasingIn="SinOut"
          EasingOut="SinIn"
          HasBackgroundAnimation="True"/>
    </popups:PopupPage.Animation>

    <!-- Content -->
    <StackLayout 
           VerticalOptions="Center" 
           HorizontalOptions="FillAndExpand" 
           Padding="20, 20, 20, 20">
           <StackLayout BackgroundColor="White">
             <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="60"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                </Grid.RowDefinitions> 
              </Grid>

              <StackLayout >
                <Label 
                     Text="DELETE_POPUP_INFO"
                     HorizontalTextAlignment="Center" 
                     VerticalTextAlignment="Center"/>


                <Grid BackgroundColor="White" Padding="20, 20, 20, 20">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50*"/>
                        <ColumnDefinition Width="50*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>

                    <!-- Cancel button-->
                    <Button x:Name="CancelButton"
                            Command="{Binding TappedCloseCommand}"
                            Grid.Row="0"
                            Grid.Column="0"
                            Text="CANCEL" 
                            BorderWidth="1"
                            BorderRadius="0">
                        <Button.BorderRadius>
                            <!-- fixes a bug on android where border doesn't work without a radius. -->
                            <OnPlatform x:TypeArguments="x:Int32">
                                <OnPlatform.Android>1</OnPlatform.Android>
                            </OnPlatform>
                        </Button.BorderRadius>
                    </Button>

                    <!-- Delete button-->
                    <Button x:Name="DeleteButton"
                            Command="{Binding TappedDeleteCommand}"
                            Grid.Row="0"
                            Grid.Column="1"
                            Text="DELETE"  
                            WidthRequest="500"
                            BorderRadius="0">
                    </Button>
                </Grid>
            </StackLayout>
        </StackLayout>
    </StackLayout>

</pages:BasePopupPage>

enter image description here

xamarin xamarin.ios popup statusbar
1个回答
0
投票

我使用您的代码并创建一个弹出页面。它按例外方式工作。我将向您展示我使用的代码,您可以看一下。

这是我用来显示弹出窗口的按钮事件:

private void Button_Clicked(object sender, EventArgs e)
{
    PopupNavigation.Instance.PushAsync(new Page1());
}

而且我没有在弹出页面中添加其他代码:

public partial class Page1 : PopupPage
{
    public Page1()
    {
        InitializeComponent();
    }
}

Xaml中的代码与您相同,我将Rg.Plugins.Popup与版本1.1.5.188一起使用。

如果需要,我可以与您分享样品。

这是屏幕截图:

image

© www.soinside.com 2019 - 2024. All rights reserved.