Skip to content

Screen size

Get screen width & height

val screenWidth = ScreenSizeUtils.getMobileScreenWidth()
val screenHeight = ScreenSizeUtils.getMobileScreenHeight()

Screen size with screen orientation

Take 2400*1080 as example。

Screen Orientation Width Height
Configuration.ORIENTATION_PORTRAIT 1080 2400
Configuration.ORIENTATION_LANDSCAPE 2400 1080

Status bar height

val statusBarHeight = ScreenSizeUtils.getStatusBarHeight(this@MainActivity)

Screen Orientation

val screenOrientation = ScreenSizeUtils.getScreenOrientation()

Sample code

Sample code