0

私のXamarin.Formsアプリケーションには、一番下にボタンがあります。このボタンは、Windows 10の携帯電話では表示されません。私のページのサイズが利用可能なサイズに適応しているという設定はありませんか?このような場合、ナビゲーションバーが表示されている場合はマイページの高さが低くなり、ナビゲーションバーが隠れている場合はページの高さが高くなります。Windows 10の下のナビゲーションバーの処理

ナビゲーションバーをプログラム的に隠すことを提案するソリューションがありました。例えば。

ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); 

どこに配置しますか?私はrootFrame.Navigateの前にApp.xaml.csに入れて、OnLaunchedに入れます。ローカルマシンでアプリを実行すると、フルスクリーンに変更されました。携帯電話では、ナビゲーションバーは隠されていたが、下部に白い部分が残っていた。

はさらに私は

ApplicationView.GetForCurrentView().FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Minimal; 

を試してみましたが、私は別の何かが表示されません。

開発者は、その下のコンテンツを隠すことなくナビゲーションバーをどのように処理する必要がありますか?

答えて

0

これは、問題を修正するようだ:

ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; 

結果は、アプリを起動するときにナビゲーションバーが表示されていないということです。ユーザーはスワイプでナビゲーションバーを表示することができます。ここで、ページは自動的に必要に応じてサイズが変更されます。

私はOnLaunched方法でApp.xaml.csにそれを置く:このようなonLauched機能でUWPためApp.xaml.csファイルで

ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible); 

:あなたが使用することもでき

protected override void OnLaunched(LaunchActivatedEventArgs e) 
{ 
    Frame rootFrame = Window.Current.Content as Frame; 

    // Do not repeat app initialization when the Window already has content, 
    // just ensure that the window is active 
    if (rootFrame == null) 
    { 
     // Create a Frame to act as the navigation context and navigate to the first page 
     rootFrame = new Frame(); 

     rootFrame.NavigationFailed += OnNavigationFailed; 

     Xamarin.Forms.Forms.Init(e); 

     if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 
     { 
      //TODO: Load state from previously suspended application 
     } 

     // Place the frame in the current Window 
     Window.Current.Content = rootFrame; 
    } 

    if (rootFrame.Content == null) 
    { 
     // When the navigation stack isn't restored navigate to the first page, 
     // configuring the new page by passing required information as a navigation 
     // parameter 
     ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; 
     rootFrame.Navigate(typeof(MainPage), e.Arguments); 
    } 
    // Ensure the current window is active 
    Window.Current.Activate(); 
} 
0

protected override void OnLaunched(LaunchActivatedEventArgs e) 
    { 
     if (System.Diagnostics.Debugger.IsAttached) 
     { 
      this.DebugSettings.EnableFrameRateCounter = true; 
     } 

     Frame rootFrame = Window.Current.Content as Frame; 

     // Do not repeat app initialization when the Window already has content, 
     // just ensure that the window is active 
     if (rootFrame == null) 
     { 
      // Create a Frame to act as the navigation context and navigate to the first page 
      rootFrame = new Frame(); 

      rootFrame.NavigationFailed += OnNavigationFailed; 

      Xamarin.Forms.Forms.Init(e); 

      if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 
      { 
       //TODO: Load state from previously suspended application 
      } 

      // Place the frame in the current Window 
      Window.Current.Content = rootFrame; 
     } 

     if (rootFrame.Content == null) 
     { 
      // When the navigation stack isn't restored navigate to the first page, 
      // configuring the new page by passing required information as a navigation 
      // parameter 
      ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible); 
      rootFrame.Navigate(typeof(MainPage), e.Arguments); 
     } 
     // Ensure the current window is active 
     Window.Current.Activate(); 
    } 

これは、あなたのアプリが可視のar ea、下のナビゲーションバーからのオーバーレイはありません。

関連する問題