简体   繁体   中英

Changing status bar background and text color in Android WebView

I am programming my WebView app in android studio and I want dynamically changing the background and text color of the status bar.

I created a JavaScript interface which calls the java function and changed the background to black.

getWindow.setStatusBarColor(getResources().getColor(R.color.black));

It works well, but I can't change color of text to white. So icons and text are invisible.

Is there any way I can do that? Thanks in advance for any help.

Try this:

getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM