How Get height of the Status Bar and Soft Key Buttons Bar?

前端 未结 2 2016
清酒与你
清酒与你 2020-12-15 06:41

Is there a way in Android to get the size of the soft buttons bar and status bar togheter? or a way to go get the screen height without the height of both these bars? (they

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 07:10

    for me, in android note 10, I need to get navigation bar height by dimen:

    fun getSoftNavigationBarSize(resources: Resources): Int {
        var result = 0
        val resourceId: Int = resources.getIdentifier("navigation_bar_height", "dimen", "android")
        if (resourceId > 0) {
            result = resources.getDimensionPixelSize(resourceId)
        }
        return result
    }
    

提交回复
热议问题