getRawDimension

fun TypedArray.getRawDimension(context: Context, @StyleableRes index: Int, defaultValue: Float): Float

Returns a dimension converted to pixels from a complex unit (such as dp or sp), and divides it by the pixel density of the screen.