-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Set StatusBar color and StatusBarStyle for iOS Android and UWP from Page #8298
Conversation
…-bar-color # Conflicts: # Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
The implementation in UWP would not be complex. Then, you could modify the |
@jsuarezruiz thanks for help with UWP :) |
@jsuarezruiz I also want to add the ability to change the color of the text in the StatusBar. |
@KSemenenko Let's see if I can help you a little bit. Let's start with UWP. This case is quite simple. You can access to the
It is also possible to modify back button colors, inactive status colors, etc. More info: https://docs.microsoft.com/en-us/windows/uwp/design/shell/title-bar In Android you have the code for the background color. After get the current Window, use the
Since Android M (23) it is possible to set a predefined status bar text colour theme to light or dark https://developer.android.com/reference/android/R.attr#windowLightStatusBar.
In iOS, since iOS 7 it is possible to set a predefined status bar text colour theme to light or dark. You have to manipulate the Info.plist.
Next:
I hope that helps! |
Hello @jsuarezruiz I fixed the code. |
But there’s something else to fix. |
about |
So, |
I updated the branch and now the code works as it should. Pay attention |
If I need to fix something, please write to me, I will do everything quickly. |
@KSemenenko are your latest commits a merging of what I was thinking and what you have? |
yes @PureWeen, that’s all I have with some of your fixes. |
@PureWeen btw, thank for this
it's real cool! |
…-bar-color # Conflicts: # Xamarin.Forms.Platform.UAP/Shell/ShellRenderer.cs
Conflicts fixed. |
@KSemenenko I'm not sure if (or when) this could get merged into Xamarin.Forms. However, would you be willing to contribute this to the Xamarin.CommunityToolkit if it is decided that it won't make it in? I think people would love to be able to use this functionality sooner than later 👍 (I know I would) https://github.com/xamarin/XamarinCommunityToolkit |
Hello @sthewissen
I need to know exactly whether the page is showing now or not. So I have no idea how I can add this to XamarinCommunityToolkit. |
@KSemenenko you can do it without // shared layer
public static ChangeStatusBarColor(Color color) => PlatformChangeStatusBarColor(color);
//Platform Specific
static PlatformChangeStatusBarColor(color)
{
// Do stuffs here
} |
Could we move this to the Xamarin Community Toolkit? |
I think that makes a lot of sense to move it over. |
Great, so @jamesmontemagno and @jsuarezruiz we already have an opened PR for this feature on XCT xamarin/XamarinCommunityToolkit#812 So, can we close this one? |
Description of Change
With the advent of the black theme on iOS and generally good opportunities for adjusting colors, there was a need to be able to change the color of the StatusBar on the page.
Issues Resolved
API Changes
New properties for Page
Added:
Important
For iOS it require changes into info.plist (maybe it can be put into Xamarin.Forms project template for VS and VS for Mac)
If this flag is not set, then the StatusBarStyle will not be changed.
The priority settings for the StatusBar are on the container pages TabbedPage, CaruselPage, NaviationPage. it is higher than just pages. And their StatusBar settings will overwrite the settings of the page.
Platforms Affected
Behavioral/Visual Changes
@jsuarezruiz thanks for this animation

Before/After Screenshots
Testing Procedure
PR Checklist