getDimensionByAttr

fun Context.getDimensionByAttr(@AttrRes attrRes: Int): Float

Returns a pixel representation of the dimen value that the given attrRes refers to.

Note: Density pixels are automatically converted to their pixel values based on the Context's density.

Throws

if the given attribute cannot be found.