0
votes

How can I change the software back button layout color at the bottom for xamarin.forms android app? It only shows white color. If we open google photos app we can see that the color is managed. Please refer the images.

1. Xamarin.forms android app with white background for software back button

enter image description here

2. Google Photos app with dark color for software back button layout.

enter image description here

How can we change the color? Any Help is appreciated.

2

2 Answers

1
votes
1
votes

If your Api version is Level 21 or above (Android 5.0 and above).You could use SetNavigationBarColor method to set the background color.

protected override void OnCreate(Bundle savedInstanceState)
    {
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
        {
            Window.SetNavigationBarColor(Android.Graphics.Color.Red);
        }

        base.OnCreate(savedInstanceState);
         
        ...
   }