Search code examples
androidandroid-jetpack-compose

CircularProgressIndicator() doesn't work inside an enabled button?


The CircularProgressIndicator() not loading inside an enabled button, works fine inside a disabled button though.

  Button(onClick = {}, enabled = false) {
      CircularProgressIndicator()
  }                  

Is there a way to show the CircularProgressIndicator inside a button even when it is enabled?


Solution

  • The indicator does work inside enabled button!

    The enabled argument doesn't handle whether to show/hide content provided in Button component.

    In your case, the CircularProgressIndicator is there but due to same color in button and indicator, you aren't be able to see it. Try changing indicator color!!

    Button(onClick = {}, enabled = true) {
        CircularProgressIndicator(color = Color.Black)
    }