Exploring BasicText and Text in Compose

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

When it comes to displaying text, Compose offers two composables, Text and BasicText, for high-level and low-level text rendering, respectively.

Exploring BasicText in Compose

BasicText is a barebones composable that offers low-level text rendering ability and semantics/accessibility information with limited options. Here’s what its signature looks like:

Exploring Text in Compose

Before learning how to use the Text Composable, you’ll examine its signature and see how much it differs from BasicText.

Using Text

The simplest way to display text in compose is by using the Text composable and passing a string as a parameter.

Styling Text

Some common options to style your text would be to change the color, font size, and font weight.

Skewing Your Text

To skew your text, you can use the style property along with a textGeometricTransform as shown below.

Adding Shadow to Your Text

The style parameter of the text composable lets you configure multiple parameters, such as shadow.

Using Gradient as Text Color

Using the style parameter, you can also opt for using a gradient as the text color. Here’s what using a gradient as the text color looks like:

Styling Paragraphs

Now that you’ve covered how to style individual blocks of text, it’s time to look at how to style paragraphs.

See forum comments
Download course materials from Github
Previous: Introduction Next: Using Text Composable in App