Android Jetpack Compose – Text
Text composable function is used to display text in Android application.
The most basic example to define a Text composable with a string to display text is as shown in the following.
</>
Copy
Text("Hello World")
We can also style this text, using optional parameters that Text composable provide.
For example, to change the color of the text, set color parameter to a Color value, as shown in the following.
</>
Copy
Text("Hello World", color = Color.Blue)
As simple as that.
The following is a list of tutorials, that cover styling and how-to concepts with Text composable.
Basic tutorials on Text Composable
Text Styling
- Change Text Color in Compose
- Change Text Font Size in Compose
- Change Text to Italic in Compose
- Change Text to Bold in Compose
- Set Width for Text in Compose
- Set Height for Text in Compose
- Set Padding for Text in Compose
- Set Font Weight for Text in Compose
- Set Custom Font Family for Text in Compose
- Use AnnotatedString for Text in Compose
- Make Text Selectable in Compose
Conclusion
In this Android Jetpack Compose Tutorial, we learned what Text composable is, and how to style the text of a Text composable, with the help of individual tutorials for each concept.