-
-
Save CodingDoug/489045d5a92be732dec9 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
import android.view.View | |
fun View.dp_f(dp: Float): Float { | |
return TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_DIP, dp, context.resources.displayMetrics) | |
} | |
fun View.dp_i(dp: Float): Int { | |
return dp_f(dp).toInt() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment