createDp

fun createDp(@ColorInt color: Int, alpha: Float = -1.0f, widthDp: Float? = null, heightDp: Float? = null, style: Style? = null): SolidColor

Java-compatible factory method that accepts dp values for dimensions. Use this method when calling from Java code with dp values (e.g., from .widthDip() or .heightDip() calls).

Parameters

color

The color to render.

alpha

The alpha of the color, in the range 0.0, 1.0. Use -1.0f to use color's alpha.

widthDp

Width in dp, or null to not set.

heightDp

Height in dp, or null to not set.

style

Additional style to apply, or null for no additional style.