【发布时间】:2021-08-21 15:50:34
【问题描述】:
【问题讨论】:
-
请将您的代码以文本形式发布。参考这个原因,meta.stackoverflow.com/questions/285551/…
【问题讨论】:
因为您没有监听 limonadeState 的变化。 假设您将 when 语句放在 Activity 的 onCreate 方法中,并且 onCreate 在生命周期中只运行一次@see https://developer.android.com/guide/components/activities/activity-lifecycle
要实现您的预期行为,请提取 when 语句并包装在一个函数中,并在 limonadeState 状态更改时手动调用。
【讨论】: