Draw text in Compose
Stay organized with collections
Save and categorize content based on your preferences.
See how to use Compose APIs specifically designed to draw text on a canvas. This
segment shows the code to draw an emoji font in a rounded rectangle.
Key points
- In Compose, you can draw text on a canvas by creating a text measure and
calling
drawText
, resulting in the measuring string.
- You can also customize the text size, alignment, and other properties.
Collections that contain this guide
This guide is part of these curated Quick Guide collections that cover
broader Android development goals:
Display text
Text is a central piece of any UI. Find out different ways
you can present text in your app to provide a delightful user
experience.
Display images
Discover techniques for using bright, engaging visuals to
give your Android app a beautiful look and feel.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-06 UTC."],[],[],null,["# Draw text in Compose\n\n\u003cbr /\u003e\n\nSee how to use Compose APIs specifically designed to draw text on a canvas. This\nsegment shows the code to draw an emoji font in a rounded rectangle. \n\nKey points\n----------\n\n- In Compose, you can draw text on a canvas by creating a text measure and calling [`drawText`](/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope#(androidx.compose.ui.graphics.drawscope.DrawScope).drawText(androidx.compose.ui.text.TextLayoutResult,androidx.compose.ui.graphics.Brush,androidx.compose.ui.geometry.Offset,kotlin.Float,androidx.compose.ui.graphics.Shadow,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.graphics.drawscope.DrawStyle,androidx.compose.ui.graphics.BlendMode)), resulting in the measuring string.\n- You can also customize the text size, alignment, and other properties.\n\nCollections that contain this guide\n-----------------------------------\n\nThis guide is part of these curated Quick Guide collections that cover\nbroader Android development goals: \n\n### Display text\n\nText is a central piece of any UI. Find out different ways you can present text in your app to provide a delightful user experience. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-text) \n\n### Display images\n\nDiscover techniques for using bright, engaging visuals to give your Android app a beautiful look and feel. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-images) \n\nHave questions or feedback\n--------------------------\n\nGo to our frequently asked questions page and learn about quick guides or reach out and let us know your thoughts. \n[Go to FAQ](/quick-guides/faq) [Leave feedback](https://issuetracker.google.com/issues/new?component=1573691&template=1993320)"]]