Android ProgressBar
ProgressBar:
ProgressBar is a user interface element that visually represents the progress of a task or operation.
It provides a graphical indication, often in the form of a horizontal or circular bar, to show users that some work is in progress, and it gives them a sense of how much of the task has been completed.
There are two main types of ProgressBar in Android:
- Horizontal ProgressBar:
- Circular ProgressBar:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProgressBarExample"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click on start button"
android:layout_marginBottom="20dp"/>
<ProgressBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:max="100"
/>
<Button
android:id="@+id/start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:textColor="@color/colorWhite"
android:background="@color/colorOrange"
/>
</LinearLayout>
Output