ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsets ->
val statusBarInsets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
val statusBarHeight: Int = <http://statusBarInsets.top|statusBarInsets.top>
}
Does anyone knows, why I’m I getting statusBar height as zero, this will be called multiple times, sometimes I see the actual height of the status bar but sometimes it does reset to zero.
Appreciate your help
l
Luis
08/02/2021, 10:56 PM
Not sure why are you measuring the top of the status bar? Shouldn’t the bottom be the height? On Android 0 is the topmost pixel