我想将这些方法runSec
和runMin
移动双手结合在一种方法中。这些方法移动钟面上的分针和秒针 求助,谢谢。
public void settTime(int seconds) {
if(isTimer)
return;
tTime = seconds;
int minutes = seconds / 60;
int hours = minutes / 60;
minutes = minutes % 60;
seconds = seconds % 60;
tTimeLabel.setText(String.format("%02d:%02d:%02d", hours, minutes, seconds));
runSec(seconds);
runMin(minutes);
}
public void runSec(int seconds) {
RotateAnimation rotateAnimation = new RotateAnimation(seconds * 6, seconds * 6,
Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setFillAfter(true);
csecond.startAnimation(rotateAnimation);
}
public void runMin(int minutes) {
RotateAnimation rotateAnimation = new RotateAnimation(minutes * 6, minutes * 6,
Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setFillAfter(true);
cminute.startAnimation(rotateAnimation);
}