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 #823

Open TauseefDev opened 3 months ago

TauseefDev commented 3 months ago

URL of codelab

class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { HappyBirthdayTheme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { GreetingText(message = "Happy Birthday Sam!") } } } } }

@Preview(showBackground = true) @Composable fun BirthdayCardPreview() { HappyBirthdayTheme { GreetingText(message = "Happy Birthday Tauseef!") } }

@Composable fun GreetingText(message: String, modifier: Modifier = Modifier) { Text( text = message, modifier = modifier ) }

Describe the problem

Can't run the code showing 5 errors

Steps to reproduce?

  1. Just run It

Versions Android Studio version: Android studio Koala API version of the emulator: api 35

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