Search code examples
androidkotlinandroidxandroid-progressbarandroid-jetpack-compose

How can I render plain android ProgressBar with Compose?


My application needs a ProgressBar, and I am trying to implement it with Jetpack Compose, so either I need a builtin ProgressBar support (I didn't find it) or there should be a mechanism to display plain Android Widgets with Compose. Is anything of this possible?


Solution

  • Ofcourse, we have Progress Bars in Jetpack Compose:

    CircularProgressIndicator: Displays progress bar as Circle. It is indeterminate. Themed to Primary color set in styles. Another variant is determinate that takes progress in argument as Float (0.0f - 1.0f)

    Example:

    // Indeterminate
    CircularProgressIndicator()
    
    // Determinate
    CircularProgressIndicator(progress = 0.5f)
    

    LinearProgressIndicator: Displays progress bar as line. It is indeterminate. Themed to Primary color set in styles. Another variant is determinate that takes progress in argument as Float (0.0f - 1.0f)

    Example:

    // Indeterminate
    LinearProgressIndicator()
    
    // Determinate
    LinearProgressIndicator(progress = 0.5f)