Create Composables with Jetpack Compose

Sep 10 2024 · Kotlin 1.9, Android 14, Android Studio Jellyfish | 2023.3.1

Lesson 02: Modify Composables

Demo

Episode complete

Play next episode

Next

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

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

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

Unlock now

Open the Starter project in the 02-modify-composables directory of the m3-cjp-materials repo in Android Studio Jellyfish or later.

Button( 
	onClick = { Log.d("HelloCompose", "Hello Compose clicked!") },  
	content = { Text(text = "Click Me") }
)
import androidx.compose.material.Button
import androidx.compose.material.Text
@Composable  
fun HelloCompose(modifier: Modifier = Modifier) {  
	Button(  
		modifier = modifier,  
		onClick = { Log.d("HelloCompose", "Hello Compose clicked!") },  
		content = { Text(text = "Click Me") }
	)  
}
Box(modifier = Modifier  
	.background(Color.Yellow.copy(alpha = 0.4f))  
	.padding(16.dp)  
	.fillMaxSize()  
)
import androidx.compose.ui.graphics.Color
HelloCompose(  
	modifier = Modifier  
		.fillMaxWidth()  
		.align(Alignment.Center),  
)
import androidx.compose.ui.Alignment
Button(modifier = modifier.rotate(30f)),

See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Conclusion