0

I have a horizontal progress bar in splash screen and I am trying to give it horizontal left to right animation. I have tried simple animate method as well as object animator method but it is not working am I doing anything wrong here?

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="wrap_content"

    android:layout_height="wrap_content"
    android:id="@+id/splash_progressbar"
    android:progress="1000"
    android:max="1000"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="203dp" />

java code using object animator.

splashProgress = (ProgressBar) findViewById(R.id.splash_progressbar);

ObjectAnimator progressAnimator = ObjectAnimator.ofInt(splashProgress, "progress", 1000, 0);
    progressAnimator.setInterpolator(new LinearInterpolator());
    progressAnimator.start();

with simple animate method.

    splashProgress.setScaleX(0); splashProgress.setScaleY(0);
    splashProgress.animate().scaleX(1).scaleY(1).start();
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31

0 Answers0