gpt4 book ai didi

android - Jetpack Compose 中的下拉按钮/滚轮选择器/微调器

转载 作者:行者123 更新时间:2023-12-04 13:08:49 37 4
gpt4 key购买 nike

Jetpack Compose 中是否有针对 Spinner/Wheel Picker 或 Dropdown Button 等视觉组件的标准实现?

最佳答案

您可以使用 ButtonDropdownMenu .
就像是:

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)
}
}
}
enter image description here
enter image description here

关于android - Jetpack Compose 中的下拉按钮/滚轮选择器/微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67842511/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com