toDp

@JvmName(name = "numberToDp")
fun <N : Number> N.toDp(context: Context): N

Convert px to dp.

Looks like: 36px → 10dp (Please refer to the target device).

Receiver

the original dimension.

Return

N

Parameters

context

the current context.


@JvmName(name = "numberToDp")
fun <N : Number> N.toDp(resources: Resources): N

Convert px to dp.

Looks like: 36px → 10dp (Please refer to the target device).

Receiver

the original dimension.

Return

N

Parameters

resources

the current resources.