小编Sku*_*per的帖子

如何使用 Any 类型包裹价值?使用@Parcelize

我在尝试将值放入 Any 类型时遇到问题?成包裹。我正在使用来自 kotlinx.android.parcel 的 @Parcelize。Lint 警告我并提示要添加的消息@RawValue,但这没有帮助。我有:

android.os.BadParcelableException: 解组时出现 ClassNotFoundException

我的数据类:

@Parcelize
    data class FormulaNode(
            val term: @RawValue Any? = null,
            val operator: String? = null,
            val left: FormulaNode? = null,
            val right: FormulaNode? = null) : Parcelable
Run Code Online (Sandbox Code Playgroud)

android parcel parcelable kotlin

10
推荐指数
1
解决办法
2577
查看次数

面向 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一

需要帮忙。我收到三星手机用户的标题中描述的崩溃。我已经添加了FLAG_IMMUTABLE我myFlags or FLAG_IMMUTABLE所有的 PendingIntents。应用程序在我的 Pixel 3 上没有崩溃。我尝试添加workmanager版本 2.7.0,这是在类似问题的其他答案中推荐的,但它仍然崩溃。

有人对此有任何提示吗?

android android-pendingintent android-12

5
推荐指数
1
解决办法
2000
查看次数

材质按钮样式形状外观不起作用

我正在努力为项目中的按钮设置正确的样式。我不知道为什么shapeAppearance不工作。即使我只使用cornerSize它也不起作用。

我有一个按钮的基本样式:

<style name="SnButton" parent="Widget.MaterialComponents.Button.UnelevatedButton">
    <item name="shapeAppearance">@style/MyShapeAppearance</item>
    <item name="backgroundTint">@null</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这是我的按钮形状外观:

<style name="MyShapeAppearance" parent="ShapeAppearance.MaterialComponents.SmallComponent">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">2dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这是我的基本主题:Theme.MaterialComponents.Light.NoActionBar.Bridge

在我的情况下,我应该怎么做才能强制shapeAppearance工作?或者至少cornerSize?

android-button material-design material-components-android

0
推荐指数
1
解决办法
778
查看次数