I'm using a progress bar where it has a gray color behind (primary process) and a blue color on top (secondary process). I used ObjectAnimator to give an animation in the progress bar when using only the primary, but now I can not make the secondary also use the animation. Follow the code:
Modification made in progress bar:
<item android:id="@android:id/progress">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="10sp"
android:useLevel="false">
<gradient
android:centerColor="#00A6FF"
android:endColor="#00A6FF"
android:startColor="#00A6FF"
android:type="sweep"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="10sp"
android:useLevel="true">
<gradient
android:centerColor="@color/gray"
android:endColor="@color/gray"
android:startColor="@color/gray"
android:type="sweep"/>
</shape>
</item>
ObjectAnimator Method:
private void progressBar() {
ObjectAnimator animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 50);
animation.setDuration(5000); // in milliseconds
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
}