将进度条最大值设置为 500 并实现此计时器将解决问题。我试过了,它对我有用
InsideMMduration = mMediaPlayer.getDuration();
amoungToupdate = InsideMMduration / 500;
// TimerTask for updating the SeekBar while playing.
task = new TimerTask() {
@Override
public void run() {
Graphbar.post(new Runnable() {
@Override
public void run() {
if (mMediaPlayer != null) {
if (playButtonState == MediaMode.PLAY) {
if (mMediaPlayer.isPlaying()) {
if (!(amoungToupdate
* Graphbar.getProgress() >= InsideMMduration)) {
int tempP = Graphbar.getProgress();
tempP += 1;
Graphbar.setProgress(tempP);
enableRewindandForward();
}
}
}
}
}
});
}
};
timer = new Timer();
timer.schedule(task, 0, amoungToupdate);