I want to design the status bar with white color, but the color of text and icon of notification the same color, so how can I change the text color of the status bar?.
The status bar color
before:
I want to design the status bar with white color, but the color of text and icon of notification the same color, so how can I change the text color of the status bar?.
The status bar color
before:
Okey, @Harry Android is different with IOS.
right now my priority is Android, so yes. iOS may be in the future
Android:
Android 6.0 started, Google officially provided support, configure android:windowLightStatusBar in the style attribute
Yes, when set to true, when the background color of the statusbar is light, the text color of the statusbar will be grayed out. The same is true for false.As follow:
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
...
<item name="android:windowLightStatusBar">false</item>
</style>
In xamarin.forms can follow this link to get success.
Basically you have to use FormsAppCompatActivity instead of FormsApplicationActivity and Theme.AppCompat.Light.NoActionBar instead of Theme.Material.Light.
If want some page show different style ,can change it in activity's theme.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".Activity.SecondActivity"
android:launchMode="singleTop"
android:theme="@style/customttheme"/>
</application>
IOS:
(1), add follow key-value to info.plist in Project.IOS:
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
(2) Not using code:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
(3),Or use code to set text color of status bar, method FinishedLaunching in AppDelegate.cs set as follow:
app.StatusBarStyle = UIStatusBarStyle.LightContent;
(4)If want some page change color after launching app ,can custom ViewControllerRenderer for IOS , in ViewDidLoad() method :
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
Please, see this answer: background status bar color.
According to this link, you need to set values of BarBackgroundColor and BarTextColor to your specific color like so:
...
MainPage = new MainPageUser();
//Background color
MainPage.SetValue(NavigationPage.BarBackgroundColorProperty, Color.Black);
//Title color
MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);
...
Also:
But like you probably notice now is that the status bar in iOS on top is also black and that you´ll need to change in the Info.plist file in your ios project and open it (right click and choose "open with") with xml editor and add these lines of code:
according to this comment you need to change your info.plist like this:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Hope this will help.
In Xamarin.Forms from iOS 12 and Above you simply make this in info.plist:
In the right side you can choose color.