Compose by remember 报错问题

在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

你可能感兴趣的:(Compose by remember 报错问题)