我在格式化textView上的字符串時遇到了很多問題。我創建一個秒錶應用程序,我需要把它格式化爲「00:00:00」,但是當我啓動秒錶,說到爲「00:00:000」在textView中格式化android文本問題
下面是代碼
private Runnable updateTimerThread = new Runnable() {
public void run() {
timeInMilliseconds = SystemClock.uptimeMillis() - startTime;
updatedTime = timeSwapBuff + timeInMilliseconds;
int secs = (int) (updatedTime/1000);
int mins = secs/60;
secs = secs % 60;
int milliseconds = (int) (updatedTime % 1000);
timerValue.setText(String.format("%02d:%02d:%02d", mins, secs, milliseconds));
customHandler.postDelayed(this, 0);
}
};
讓我知道你是否需要更多信息。
在此先感謝