Как мне анимировать прогресс индикатора выполнения в Android? - PullRequest
0 голосов
/ 02 августа 2020

Мой текущий код activity_main.xml для индикатора выполнения таков:

<ProgressBar
    android:id="@+id/my_progressBar"
    style="@style/Widget.AppCompat.ProgressBar.Horizontal"
    android:layout_width="282dp"
    android:layout_height="52dp"
    android:layout_marginStart="28dp"
    android:layout_marginTop="428dp"
    android:indeterminate="false"
    android:max="1854"
    android:progress="1572"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

Что дает следующее: enter image description here

Can someone guide me how to make the progress bar start from zero and reach the current point once the app is opened? Look toward the bottom of the screen at https://mechakeys.robolab.io/ для понимания того, что я пытаюсь делать.

1 Ответ

0 голосов
/ 02 августа 2020

Вот базовый c пример реализации progressView

<com.skydoves.progressview.ProgressView
  android:id="@+id/progressView1"
  android:layout_width="match_parent"
  android:layout_height="35dp"
  app:progressView_colorBackground="@color/white" // the color of the container.
  app:progressView_colorProgress="@color/skyBlue" // the color of the progress bar.
  app:progressView_progress="40" // progress value.
  app:progressView_min="15" // min progress value.
  app:progressView_max="100" // max progress value.
  app:progressView_progressFromPrevious="true" // animates progress from previous progress.
  app:progressView_autoAnimate="true" // starts filling animation automatically when finishing inflate.
  app:progressView_radius="12dp" // the corner radius of the progressView and progress bar.
  app:progressView_padding="1dp" // the padding of the progress bar.
  app:progressView_labelColorInner="@color/white" // the text color when the label placed on the progress bar.
  app:progressView_labelColorOuter="@color/black" // the text color when the label placed out of the progress bar.
  app:progressView_labelSize="13sp" // the label text size.
  app:progressView_labelSpace="10dp" // the space size of the between label and progress bar. 
  app:progressView_labelText="achieve 65%" // the text of the label.
  app:progressView_labelTypeface="bold" // the typeface of the label.
 />

dependencies {
    implementation "com.github.skydoves:progressview:1.0.9"
}

Подробная информация здесь

Эта полоса прогресса показывает прогресс ProgressBar

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...