-1
我有ProgressBar的問題,因爲它沒有正確顯示它。Progressbar無法正確顯示
代碼:
private void setTimer() {
if(np3.getValue() == 0){
time_one = (np1.getValue()) + (np2.getValue() * 60);
totalTimeCountInMilliseconds = time_one * 1000;
} else {
time_two = (np1.getValue()) + (np2.getValue() * 60) + ((np3.getValue() * 3600)-3600);
totalTimeCountInMilliseconds = time_two * 1000;
}
np1.setVisibility(View.GONE);
np2.setVisibility(View.GONE);
np3.setVisibility(View.GONE);
textViewShowTime.setVisibility(View.VISIBLE);
timeseconds = 10 * 1000;
}
private void startTimer() {
countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) {
@Override
public void onTick(long leftTimeInMilliseconds) {
if (leftTimeInMilliseconds <= timeseconds) {
if(change == false){
textViewShowTime.setVisibility(View.VISIBLE);
textViewShowTime.setTextSize(20);
textViewShowTime.setTextAppearance(getApplicationContext(),
R.style.RedText);
change = true;
} else{
textViewShowTime.setVisibility(View.GONE);
change = false;
}
}
if(np3.getValue() == 0){
Date date = new Date(leftTimeInMilliseconds);
DateFormat formatter = new SimpleDateFormat("mm:ss");
String dateFormatted = formatter.format(date);
textViewShowTime.setText(String.format(dateFormatted));
textViewShowTime.setTextSize(40);
pb.setVisibility(View.VISIBLE);
if(progressStatus <100){
int end_time = 100/time_one;
progressStatus += end_time;
pb.setProgress(progressStatus);
}
我已經改變了,但後來我曾與閃爍的文字一個問題,說這是不是我想要的:/ – tomecki
我改變,現在有這樣的事情 https://drive.google.com/file/d/0B3LWRfNDCNdBSHB6RGRxTUYydXc/view?usp=sharing – tomecki
你能否更新你的問題。 –