在倒数计时器中添加小时数,我只有几分钟然后如何格式化它
private void updateCountDownText() {
int hours = (int) (mTimeLeftInMillis / 1000) / 36000;
int minutes = (int) (mTimeLeftInMillis / 1000) / 60;
int seconds = (int) (mTimeLeftInMillis / 1000) % 60;
String timeLeftFormatted = String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, minutes, seconds);
mTextViewCountDown.setText(timeLeftFormatted);
}
慕斯王
相关分类