Compose by remember 报错问题

2023-10-22  本文已影响0人  xiaoxuan0115

在compose中

 var selectedIndex by remember {
            mutableStateOf(0)
    }

IDE报错:Type 'Type Variable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate

解决办法:

需要导入包

import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
上一篇 下一篇

猜你喜欢

热点阅读