Is there any standard implementation in Jetpack Compose for visual component like Spinner/Wheel Picker or Dropdown Button?
Recomposition is when Jetpack Compose re-executes the composables that may have changed in response to state changes, and then updates the Composition to reflect any changes. A Composition can only be produced by an initial composition and updated by recomposition.
Jetpack Compose is a modern declarative UI Toolkit for Android. Compose makes it easier to write and maintain your app UI by providing a declarative API that allows you to render your app UI without imperatively mutating frontend views.
Today, we're releasing version 1.2 of Jetpack Compose, Android's modern, native UI toolkit, continuing to build out our roadmap.
Jetpack Compose is a modern toolkit that allows us to build our screens in a declarative approach writing less code. Android UI Development is now more powerful and more decoupled. Before Jetpack Compose, we were using XML layouts to build the native UI.
You can use a Button
with a DropdownMenu
.
Something like:
var expanded by remember { mutableStateOf(false) }
val suggestions = listOf("Item1", "Item2", "Item3")
Button(onClick = { expanded = !expanded }){
Text ("DropDown")
Icon(
imageVector = Icons.Filled.ArrowDropDown,
contentDescription = null,
)
}
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
) {
suggestions.forEach { label ->
DropdownMenuItem(onClick = {
expanded = false
//do something ...
}) {
Text(text = label)
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With