S
S
Sasha Brahms2016-08-02 13:56:58
Android
Sasha Brahms, 2016-08-02 13:56:58

Gradual decrease in progressBar by timer?

Hello everyone, there is a progress bar, you need to reduce it, 8 seconds.
I did this:
the maximum value of progressBar 800 every 10 milliseconds, the timer reduces its value by 1.
Is this generally normal?
The timer will run 800 times, is that normal?
MB start 1 timer for 8 seconds, and make the decrease somehow an animation?
Please tell me, it seems to me that this is a very difficult device ..

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
itdroid, 2016-08-02
@Dlike

Look towards Property Animation: https://developer.android.com/guide/topics/graphic...
Something like this:
layout:

<ProgressBar
        android:id="@+id/progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:max="8000"
        android:progress="8000"
        style="@style/Widget.AppCompat.ProgressBar.Horizontal"
        />

code:
ProgressBar progress = (ProgressBar) findViewById(R.id.progress);
ObjectAnimator anim = ObjectAnimator.ofInt(progress, "progress", 8000, 0);
anim.setDuration(8000);
anim.start();

D
Denis Ineshin, 2016-08-02
@IonDen

Oops)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question