gpt4 book ai didi

android - Jetpack Compose 1.0.0-alpha11如何手动导入扩展函数?

转载 作者:行者123 更新时间:2023-12-04 23:54:58 27 4
gpt4 key购买 nike

我有一个 List<Item>我想使用 Jetpack Compose 显示。在“1.0.0-alpha10”版本中,这段代码:

@Composable
fun ItemsScreen(items: List<Item>) {
item?.let {
LazyColumn {
items(
items = items
) { item ->
ItemCard(item = item)
}
}
}
}

工作正常,但是,根据新的 updates,从“1.0.0-alpha11”开始:

New items(count: Int) factory method for scope of LazyColumn/LazyRow/LazyVerticalGrid. items(items: List) and itemsIndexed(items: List) are now extension functions so you have to manually import them when used.

我的应用程序不再工作了。我不确定我是否理解:

items(items: List) are now extension functions so you have to manually import.

这是什么意思?如何解决这个问题?

提前致谢。

最佳答案

您需要为扩展函数添加此导入 LazyListScope.items() :

import androidx.compose.foundation.lazy.items

关于android - Jetpack Compose 1.0.0-alpha11如何手动导入扩展函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66043401/

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