What’s wrong with my implementation regarding light status bar flag?

  

I was looking for a solution on a darker status bar foreground on a light (white) status bar background. I am using Delphi 10.3 (Rio) and an Android version 8.1.0 device. My code supposedly works based on Android samples I have looked.

I have tried several Android references pertaining to the status bar. The following is my code that didn’t work. I don’t know what’s missing. setStatusBarColor is working setSystemUiVisibility is not.

procedure TfrmMain.FormCreate(Sender: TObject);
var
lbl: TLabel;
uiOptions: Integer;
begin
CallInUIThread(
procedure
begin
SharedActivity.getWindow.clearFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS);
SharedActivity.getWindow.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
SharedActivity.getWindow.setFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
TJWindowManager_LayoutParams.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
uiOptions := SharedActivity.getWindow.getDecorView.getSystemUiVisibility();
SharedActivity.getWindow.getDecorView.setSystemUiVisibility(TJview.JavaClass.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
SharedActivity.getWindow.setStatusBarColor(TJcolor.JavaClass.BLACK);
end);
end;

Comments are closed.