Skip to content

Instantly share code, notes, and snippets.

@kimji1
Created August 6, 2020 05:16
Show Gist options
  • Select an option

  • Save kimji1/f331e512921eb37ca45d8eaf35e70f29 to your computer and use it in GitHub Desktop.

Select an option

Save kimji1/f331e512921eb37ca45d8eaf35e70f29 to your computer and use it in GitHub Desktop.
val Int.dp: Int
get() = (this / Resources.getSystem().displayMetrics.density).toInt()
val Int.px: Int
get() = (this * Resources.getSystem().displayMetrics.density).toInt()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment