Jetpack Compose Flashcards
What is jetpack compose
A modern toolkit for building native UI on Android using declarative syntax
What is a composable function
A function that describes UI and can be recomposed efficiently when data changes
What is state in jetpack compose
Data that can change and trigger recomposition of UI
What is remember in jetpack compose
A function to create state that persists across recompositions within a composable
How do you handle navigation in jetpack compose
Using the navigation component to manage different screens and their transitions
What is LazyColumn
A composable for efficiently displaying large lists of items vertically
What is a modifier in jetpack compose
A way to change the appearance or behaviour of a composable
What’s the difference between @Composable with @Preview
@Composable is used to define a composable function, while @Preview is used to display a preview of a composable in android studio layout editor
What are state composables and stateless composables
State composables hold state and can be recomposed when the data changes
Stateless composables don’t hold state and are recomposed when their inputs change
Explain how to handle user interactions with composables
Use modifiers like clickable, onLongClick or gesture detection APIs
How do you create custom composables
Define functions annotated with @Composable that describe the UI and logic
What are slot APIs in Jetpack Compose
Allow customization of composable layouts by providing content within them
Explain how to achieve theming consistency across your app
Use MaterialTheme to provide a theme throughout the app hierarchy
How do you handle accessibility in Jetpack Compose
Use semantic properties like contentDescription and follow accessibility best practices
What are animation APIs in jetpack compose
Use AnimatedVisibility or transition to animate composable appearances or changes