google-developer-training / basic-android-kotlin-compose-birthday-card-app

Apache License 2.0
125 stars 95 forks source link

Text composables: Android Basics with Compose #836

Open chaitanyabhardwaj opened 2 months ago

chaitanyabhardwaj commented 2 months ago

URL of codelab Build a simple app with text composables

In which task and step of the codelab can this issue be found? Topic: Add greeting to the app Subheading: Align greeting to the center Step: 3

Describe the problem In step 3 of the section "Align greeting to the center"

Text(
    text = message,
    fontSize = 100.sp,
    lineHeight = 116.sp,
    textAlign = TextAlign.Center
)

This is not centring the text horizontally. I had to use modifier = Modifier.fillMaxWidth() in the text element along with it to center it horizontally.

Versions Android Studio version: 2023.3.1 API version of the emulator: 34-ext12

Additional information Include screenshots if they would be useful in clarifying the problem.