Android Compose – Create Text Composable

To create new Text in Android Jetpack Compose, use Text composable. Pass the text to display, as string argument to Text() function.


Create an Android Application with Jetpack Compose as template, and modify MainActivity.kt as shown in the following.

The Text composable, in the following activity, displays Hello World! text.


package com.example.myapplication

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.compose.material.Text
import com.example.myapplication.ui.theme.MyApplicationTheme

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        setContent {
            MyApplicationTheme {
                Text("Hello World!")

Screenshot in Emulator

Android Compose - Create Text Composable


In this Android Jetpack Compose Tutorial, we learned how to create a Text composable in Android Project with Jetpack Compose.