In this tutorial, we will create a custom progress bar in android studio. We will use a regular progress bar but will add a custom background. If you want to watch any of the videos that are created before then click here.
Watch Youtube tutorial
Create a background
To create a custom progress bar android we have to create a background which will be white and in circular shape So, to create that GOTO -> res -> drawable -> right click and create a new resource file and name it white_circle and paste the code below.
white_circle.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"></solid>
<corners android:radius="100dp"></corners>
</shape>
Create a Custom Progress Bar Android
Now to create a custom progress bar android we have to add a <RelativeLayout> in that we will add a background color and change it’s visibilty to show, Gone or hidden. Inside this relativelayout we will use the progress bar.
Progress Bar XML
<RelativeLayout
android:id="@+id/login_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/white_circle"
android:elevation="8dp"
android:padding="20dp"
android:visibility="gone">
<ProgressBar
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"/>
</RelativeLayout>