Skip to content

You cannot download the library with its correction CommonUtils.kt #43

Description

@LuiguiBalarezo

internal fun Activity.getStatusBarHeightInPx(): Int {
val rectangle = Rect()

window.decorView.getWindowVisibleDisplayFrame(rectangle)

val statusBarHeight = rectangle.top
val contentViewTop = window.findViewById<View>(Window.ID_ANDROID_CONTENT).top
return if (contentViewTop == 0) { //Actionbar is not present
    statusBarHeight
} else {
    contentViewTop - statusBarHeight
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions