How To Dim System Bars On Android?


System Bars on android mains status bar and navigation which drawn by system with your app content.In this tutorial we are gonna dim system bars on Android version 4.0 Android Higher.
When you used this approach you content does not resize but icons in system bar visually recede. And when user touch either status bar nor navigation bar area of the screen both the system bar become fully visible.
Main advantage of this approach is system bars still present but their details are observed. 
This creates immersive experience with easy access of System bars.

Dim Status Bar And Navigation Bar.

You can dim status bar and navigation bar usinSYSTEM_UI_FLAG_LOW_PROFILE  flag. 
As Shown Below. 

As soon as the user touches Status bar or Navigation bar area of the screen.the flag cleared,Resulting fully visible System bars.And If this flag cleared once,then you have to set this flag again if you want dim System bars again.

In Figure 1 we can see gallery image in which navigation bars is dimmed (Gallery Application completely hide status bar it does not dim it). You can see navigation bar right side with small white dot which is present navigation control.


Figure 1. Dimmed System Bars.
 
 You can see same image in Figure 2.But system bars displayed.

Figure 2. Visible System Bars.

 
If you want to programmatically clear flag set with setSystemUiVisibility() , You can do so as follows.

No comments:

Post a Comment