A similar question has been asked here, but not addressing dark-text status bar.
I want to achieve 3 things at the same time:
The solution
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
can only achieve 1 and 3;
The solution here can only achieve 1 and 2;
And the solution here can only achieve 2 and 3....
So is there a way to achieve all 1, 2 an 3?!
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar.
Status bar (or notification bar) is an interface element at the top of the screen on Android devices that displays the notification icons, minimized notifications, battery information, device time, and other system status details.
Inside styles.xml
:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
<item name="android:navigationBarColor">@android:color/black</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
In activity's onCreate()
:
override fun onCreate(savedInstanceState: Bundle?) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
Will result in this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With