How to get status bar height in overlay window context for Android?

153 views Asked by At

Following code will get a warning:

Using internal inset dimension resource `status_bar_height` is not supported
val statusBarHeight: Int  
    get() {  
            var result = 0  
            val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")  
            if (resourceId > 0) {  
                result = resources.getDimensionPixelSize(resourceId)  
            }  
            retur result  
    }

Is there a public API to get it (not from activity)?

0

There are 0 answers