Assigned
Status Update
Comments
[Deleted User] <[Deleted User]> #2
My current solution for the Jetpack library
val manager = WindowManager(requireContext())
var windowHeight = manager.getCurrentWindowMetrics().bounds.height()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val metrics = requireActivity().windowManager.currentWindowMetrics
val insets = metrics.windowInsets.getInsets(WindowInsets.Type.navigationBars())
windowHeight -= insets.bottom + insets.top
}
Description
This is my current code to get the height excluding the navigation bars:
As you can see the WindowMetrics height for API 30 and above includes the navigation bar. I want to remove it. But it doesn't seem possible for the Jetpack library out of the box.