By default, the ProgressBar is a circular rotation.
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
NOTE: Android Show Busy/Loading and Prevent Touch (using DialogFragment) - Kotlin.
For horizontal loading animation, set
android:indeterminate="true"
style="?android:attr/progressBarStyleHorizontal"
orstyle="@style/Widget.AppCompat.ProgressBar.Horizontal"
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
style="?android:attr/progressBarStyleHorizontal"
/>
For real horizontal progress bar
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
style="?android:attr/progressBarStyleHorizontal"
/>
repeat(10) { progressBar.progress = ((it+1)/10.0 * progressBar.max).toInt()}