嗨,我的应用程序中有一个小倒计时器,它每秒显示另一个 Drawable。
public void onTick(long millisUntilFinished) {
if(millisUntilFinished <= 4000 && millisUntilFinished >= 3001 )
{
cdImage.setBackgroundResource(R.drawable.player1_countdown_3);
cdImage2.setBackgroundResource(R.drawable.player2_countdown_3);
}
else if(millisUntilFinished <= 3000 && millisUntilFinished >= 2001 )
{
cdImage.setBackgroundResource(R.drawable.player1_countdown_2);
cdImage2.setBackgroundResource(R.drawable.player2_countdown_2);
}
if (millisUntilFinished <= 2000 && millisUntilFinished >= 1000 )
{
cdImage.setBackgroundResource(R.drawable.player1_countdown_1);
cdImage2.setBackgroundResource(R.drawable.player2_countdown_1);
}
if (millisUntilFinished <= 999 && millisUntilFinished >= 0 )
{
cdImage.setBackgroundResource(R.drawable.player1_countdown_go);
cdImage2.setBackgroundResource(R.drawable.player2_countdown_go);
}
}
但我也有文件 player1_countdown_4.png player1_countdown_5.png player1_countdown_6.png
它显示此文件而不是顺序中的正确文件:6,5,4,go
最佳答案
有时这是一个 Eclipse 错误。您应该尝试清理您的项目,看看是否有帮助。 “项目 -> 清理”
关于java - 应用程序显示错误的绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8706752/