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 Data Types
- Hello World program in Kotlin
- Kotlin | Retrieve Collection Parts
- Destructuring Declarations in Kotlin
- DatePicker in Kotlin
- Kotlin labeled continue
- Introduction to Kotlin
- Kotlin Type Conversion
- Kotlin Exception Handling | try, catch, throw and finally
- Kotlin if-else expression
- Kotlin Environment setup for Command Line
- Kotlin constructor
- Kotlin Environment setup with Intellij IDEA
- Kotlin Nested class and Inner class
- Kotlin Variables
- Kotlin Operators
- Kotlin Standard Input/Output
- Kotlin Expression, Statement and Block
- Kotlin when expression
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.