Created
February 27, 2017 08:50
-
-
Save lmller/5121b7ea70804d2abbd6f2204c885e19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val Int.dp: Int | |
get() = resources.dpToPx(this) | |
fun Resources.dpToPx(dp: Int) = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp.toFloat(), displayMetrics).toInt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment