代码
val datas = mutableListOf( "西瓜", "苹果", "芝麻", "狗熊" ) "西瓜", "苹果", "芝麻", "狗熊" ) DropdownMenu(expanded = true, onDismissRequest = { }, modifier = Modifier.width(100.dp)) { datas.forEach { DropdownMenuItem(onClick = { Log.e("tag", "吃:$it") hasShow.value = false }) { Icon(imageVector = Icons.Default.Favorite, contentDescription = "") Text(text = it, modifier = Modifier.padding(start = 10.dp)) } } } 复制代码
效果