Reputation: 303
In some cases I need to display indeterminate progress bar and then convert it to determinate in a specific case. How can this be done in compose?
Example
When downloading a file. I need to display an indeterminate progress bar as a start and then convert it to a determinate progress bar
In Views this can be done with the setIndeterminate()
. function
Upvotes: 1
Views: 680
Reputation: 363795
When you use the LinearProgressIndicator
or CircularProgressIndicator
without the progress
parameter, it is indeterminate .
You can use something like:
var indeterminate by remember { mutableStateOf(true) }
if (indeterminate) {
LinearProgressIndicator()
} else {
LinearProgressIndicator(progress = animatedProgress)
}
Upvotes: 2