Projects AndroidUtils Docs DimenUtils

Context.getStatusBarHeight

Type: fun

Returns the height of the device's status bar, in px.

Parameter Name Description
context An active context instance.

Returned Value: The height of the status bar, in pixels.

Context.getNavigationBarHeight

Type: fun

Returns the height of the device's navigation bar, in px.

Parameter Name Description
context An active context instance.

Returned Value: The height of the navigation bar, in pixels.

dpToPx

Type: fun

Converts dp units to pixels.

Parameter Name Description
dp A distance measurement, in dp.

Returned Value: The value of the provided dp units, in pixels.

pxToDp

Type: fun

Converts pixels to dp.

Parameter Name Description
pixels A distance measurement, in pixels.

Returned Value: The value of the provided pixel units, in dp.

spToPx

Type: fun

Converts sp to pixels.

Parameter Name Description
sp A distance measurement, in sp.

Returned Value: The value of the provided sp units, in pixels.

pxToSp

Type: fun

Converts pixels to sp.

Parameter Name Description
pixels A distance measurement, in pixels.

Returned Value: The value of the provided pixel units, in sp.