Android ProgressBar is a user interface control that indicates the progress of an operation. For example, downloading a file, uploading a file on the internet we can see the progress bar to estimate the time remaining in operation.
There are two modes of progressBar :-
- Determinate ProgressBar
- Indeterminate ProgressBar
In common, we use the Determinate progress mode in progressBar because it shows the quantity of progress has occurred like the (%) percentage of file downloaded, how much data uploaded or downloaded on the internet etc.
If we have to use determinate we set the style of progress bar as below:
Here, we don’t get the idea of progress of work means how much it has been completed or How long it will take to complete.
We can use indeterminate progressBar like below by setting the indeterminate attribute as true.
Different attributes of ProgressBar widgets –
|android:id||Used to uniquely identify the control|
|android:min||Used to set minimum value|
|android:max||Used to set maximum value|
|android:progress||Used to set the default progress integer value between 0 and max.|
|android:minHeight||Used to set the height of progress bar.|
|android:minWidth||Used to set the width of progress bar.|
|android:background||Used to set the background color for progress bar|
|android:indeterminate||Used to enable indeterminate progress mode.|
|android:padding||Used to set the padding for left, right, top or bottom of progress bar.|
Add ProgressBar Widget in activity_main.xml file
Access the ProgressBar Widget in MainActivity.kt file
Run as Emulator:
- Dynamic ProgressBar in Kotlin
- Kotlin Set : setOf()
- Kotlin Map : mapOf()
- Kotlin hashSetOf()
- Kotlin | apply vs with
- Comparator in Kotlin
- Triple in Kotlin
- Pair in Kotlin
- Kotlin Reflection
- HorizontalScrollView in Kotlin
- Kotlin Ranges
- Kotlin String
- Kotlin Array
- Kotlin Collections
- AutoCompleteTextView in Kotlin
- ImageButton in Kotlin
- RatingBar in Kotlin
- Button in Kotlin
- SeekBar in Kotlin
- CheckedTextView in Kotlin
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.