Created
November 8, 2022 09:13
-
-
Save cp-radhika-s/e898fff05897592085c70c2647acfdab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val textMeasure = rememberTextMeasurer() | |
var textLayoutResult by remember { mutableStateOf<TextLayoutResult?>(null) } | |
Canvas( | |
modifier = Modifier | |
.layout { measurable, constraints -> | |
val placeable = measurable.measure(constraints) | |
textLayoutResult = textMeasure.measure( | |
AnnotatedString("Text on Canvas!"), | |
style = TextStyle( | |
// text styling | |
) | |
) | |
layout(placeable.width, placeable.height) { | |
placeable.place(0, 0) | |
} | |
} | |
) { //draw } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment