I used a ProgressBar
with a custom image/drawable instead because I couldn't get other answers to work flawlessly.
Set setVisibility(View.GONE/VISIBLE)
in onBindViewHolder
as needed.
<ProgressBar
android:id="@+id/pbUpload"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/loader_rotate"
android:indeterminateDuration="1000"
android:visibility="gone" />
and the Drawable loader_rotate.xml
:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/loader"> <!-- a png image in drawable folders -->
</rotate>
</item>
</layer-list>