0
0
Android Kotlinmobile~10 mins

Text composable in Android Kotlin - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to display a simple text "Hello World" using Text composable.

Android Kotlin
Text(text = [1])
Drag options to blanks, or click blank then click option'
A"Hello World"
BHello World
CText("Hello World")
Dtext = "Hello World"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string
Passing the whole Text() call inside the text parameter
2fill in blank
medium

Complete the code to set the font size of the Text composable to 24.sp.

Android Kotlin
Text(text = "Welcome", fontSize = [1])
Drag options to blanks, or click blank then click option'
A"24.sp"
B24
Csp(24)
D24.sp
Attempts:
3 left
💡 Hint
Common Mistakes
Passing fontSize as a plain number without .sp
Passing fontSize as a string
3fill in blank
hard

Fix the error in the code to correctly display bold text using Text composable.

Android Kotlin
Text(text = "Bold Text", fontWeight = [1])
Drag options to blanks, or click blank then click option'
AFontWeight.Bold
B"Bold"
Cbold
DFontWeight.bold
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'bold' instead of FontWeight.Bold
Passing a string instead of FontWeight.Bold
4fill in blank
hard

Fill both blanks to create a Text composable with italic style and blue color.

Android Kotlin
Text(text = "Styled Text", fontStyle = [1], color = [2])
Drag options to blanks, or click blank then click option'
AFontStyle.Italic
BColor.Red
CColor.Blue
DFontStyle.Bold
Attempts:
3 left
💡 Hint
Common Mistakes
Using FontStyle.Bold instead of FontStyle.Italic
Using Color.Red instead of Color.Blue
5fill in blank
hard

Fill all three blanks to create a Text composable with underlined decoration, font size 18.sp, and green color.

Android Kotlin
Text(text = "Decorated", textDecoration = [1], fontSize = [2], color = [3])
Drag options to blanks, or click blank then click option'
ATextDecoration.Underline
B18.sp
CColor.Green
DTextDecoration.LineThrough
Attempts:
3 left
💡 Hint
Common Mistakes
Using TextDecoration.LineThrough instead of Underline
Forgetting .sp on font size
Using wrong color constant