Developer ZuBy has made some demo code available for changing the StatusBar color on Android in your apps. The status bar is the bar at the top of your device with the various icons and other information in it. In a Java based Android app to change StatusBar color you can do it either by modifying the styles.xml file and adding the following line: <item name=”android:statusBarColor”>@color/color_primary</item> or by changing at runtime (implementations may differ) through code using window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color)). However, in FireMonkey you must use the JNI (Java Native Interface). JNI enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages. Thus, you can call JNI Java code from Delphi 10 Berlin with FireMonkey and make the necessary changes. In order to make use of this change, make sure you are using Android 5 (Lollipop) and above. This code does not apply to Windows, IOS, or OSX. Notice that the code bellow is very similar to the Java implementation on Android.
procedure StatusBarSetColor(const aColor: TAlphaColor); {$IFDEF ANDROID} var Window: JWindowExt; {$ENDIF} begin {$IFDEF ANDROID} CallInUIThread( procedure begin if TOSVersion.Check(5, 0) then begin Window := GetWindowExt; Window.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS); Window.addFlags(TJWindowManager_LayoutParamsExt.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); Window.setFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS, TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS); Window.setFlags(TJWindowManager_LayoutParamsExt.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, TJWindowManager_LayoutParamsExt.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); Window.setStatusBarColor(TJcolor.JavaClass.TRANSPARENT); ); end; end); {$ENDIF} {$IFDEF IOS} SetStatusBarBackgroundColor(aColor); {$ENDIF} end;
Edit: For changing the StatusBar color on IOS check out this Github code.
Full Source for Android and iOS on my GitHub
https://github.com/rzaripov1990/fmx/tree/master/berlin/SystemBarColor
Full Source for Android and iOS on my GitHub
https://github.com/rzaripov1990/StatusBar
Do you have solution to change status bar foreground to a darker if status bar background color is light or white?