getProgressbar();
多次播放mediaPlayer.start();
,因为btnSubmit
必须多次点击。我使用水平proggres栏并且工作正常,但mediaPlayer
没有。
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getProgressBar();
}
});
private void getProgressBar() {
ObjectAnimator animator = ObjectAnimator.ofInt(progressBar, "progress", 0, 100);
animator.setDuration(duration);
animator.setInterpolator(new DecelerateInterpolator());
animator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
mediaPlayer.start();
}
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
animator.start();
}