How to change NavigationBar color in landscape mode [Avalonia.Android]? #17001
-
Hello people, I have been struggling with changing color of navigation bar. I have done a little bit of researcing on how to change the navigation bar and status bar color in Xamarin and managed to change it only for the vertical orientation like this: Window?.SetNavigationBarColor(Color.Black);
Window?.SetStatusBarColor(Color.Black); It looks and works like this: But if I switch to landscape this happens: Help me change this color in landscape mode please 😄 ! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Please use our InsetsManager if you want to change system decorations and behavior on Android. |
Beta Was this translation helpful? Give feedback.
-
Figure out, here is what I did
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:SoundScapes.ViewModels"
xmlns:views="using:SoundScapes.Views"
Loaded="UserControl_Loaded"
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="700"
x:Class="SoundScapes.Views.MainView">
....
private void UserControl_Loaded(object? sender, RoutedEventArgs e)
{
if (OperatingSystem.IsAndroid())
{
var insetsManager = TopLevel.GetTopLevel(this).InsetsManager;
insetsManager.SystemBarColor = Colors.Black;
insetsManager.DisplayEdgeToEdge = true;
}
} Works perfectly fine! |
Beta Was this translation helpful? Give feedback.
Figure out, here is what I did
MainView.xaml
:MainView.xaml.cs
: