Skip to content

Instantly share code, notes, and snippets.

@kantapp
Created March 31, 2018 08:15
Show Gist options
  • Save kantapp/8bf2d7fcd9706149b4bec10535067b9f to your computer and use it in GitHub Desktop.
Save kantapp/8bf2d7fcd9706149b4bec10535067b9f to your computer and use it in GitHub Desktop.
show/hide android status bar using kotlin
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
//make Activity fullscreen /*hide Status bar*/
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)
val button=findViewById<Button>(R.id.button)
button.setOnClickListener {
//Back Activity to normal screen /*Show Status bar*/
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment