Skip to content

Instantly share code, notes, and snippets.

@nikhil-mandlik-dev
Created June 25, 2023 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhil-mandlik-dev/c63216cf94b63367eb36eaeb4aa741c7 to your computer and use it in GitHub Desktop.
Save nikhil-mandlik-dev/c63216cf94b63367eb36eaeb4aa741c7 to your computer and use it in GitHub Desktop.
Drawing Hour Label
//draw hour
val hourString = String.format("%02d", hour)
val hourTextMeasureOutput = textMeasurer.measure(
text = buildAnnotatedString { append(hourString) },
style = clockStyle.hourLabelStyle
)
val hourTopLeft = Offset(
x = this.center.x - (hourTextMeasureOutput.size.width / 2),
y = this.center.y - (hourTextMeasureOutput.size.height / 2)
)
drawText(
textMeasurer = textMeasurer,
text = hourString,
topLeft = hourTopLeft,
style = clockStyle.hourLabelStyle
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment