我有一个数据类,其中一个变量的类型为Color
.我有逻辑来存储不同类型的 colored颜色 以在UI中显示,即
data class SubTitleModel(
val text: String,
val textColor: Color = Color.Black
)
当我从一个活动转到另一个活动时,我必须使用@Parcelize
,即
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
data class SubTitleModel(
val text: String,
val textColor: Color = Color.Black
) : Parcelable
它让我在Color
上出错
Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'
那么这意味着什么呢?如何解决这个问题?请提供详细的解释和适当的参考.谢谢