google-developer-training / basic-android-kotlin-compose-training-woof

Apache License 2.0
56 stars 87 forks source link

Flickering Animations in "(Optional) Experiment with other animations" #65

Open StewMcc opened 1 year ago

StewMcc commented 1 year ago

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-woof-animation

In which task and step of the codelab can this issue be found? (Optional) Experiment with other animations

Describe the problem

Setting .background(color = color) on the Column, results in flickering of the "Card" color on open and close.

Steps to reproduce?

  1. Get the solution code
  2. Open and close the "card"
  3. See "flickering" of the card background color

Versions Android Studio version: 2022.3.1 API version of the emulator: 34

Additional information Include screenshots if they would be useful in clarifying the problem. image

image

Using the below instead, to modify the card containerColor instead results in no flickering, and consistent behaviour.

 Card(
        modifier = modifier,
        colors = CardDefaults.cardColors(
            containerColor = color,
        ),
    )