1

I am trying to implement fully transparent statusbar so that activity background draws over statusbar. I made a research about this and found the code below working for me, at least for activity background

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    binding = ActivityMain2Binding.inflate(layoutInflater)
    setContentView(binding.root)
    setupStatusBarColor()

}

private fun setupStatusBarColor() {
    window.apply {
        clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        statusBarColor = Color.TRANSPARENT
    }
}

But when i open drawer, header layout in drawer is under the statusbar. Statusbar is not fully transparent when i open drawer. How can i solve this issue?

nasibeyyubov
  • 1,735
  • 3
  • 11
  • 28

0 Answers0