Android 动画中的倒计时
这是我在倒计时中使用的代码Android 动画中的倒计时,android,countdowntimer,Android,Countdowntimer,这是我在倒计时中使用的代码 mDetector = new GestureDetector(this, new MyGestureDetector()); ImageView iv = (ImageView)findViewById(R.id.imageView1); iv.setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View arg0, MotionEvent arg1) { m
mDetector = new GestureDetector(this, new MyGestureDetector());
ImageView iv = (ImageView)findViewById(R.id.imageView1);
iv.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
mDetector.onTouchEvent(arg1);
final ImageView iv = (ImageView) findViewById(R.id.imageView1);
iv.setVisibility(View.GONE);
new CountDownTimer(3000, 1000) {
public void onTick(long millisUntilFinished) {
AnimationDrawable loadingAnimaton;
loadingAnimation = (AnimationDrawable) ImageView.getBackground();
}loadingAnimation.start();
}.start();
return true;
}});
}
}
--我在加载animation.start()时遇到的错误代码>这么说
令牌“start”上的语法错误,此令牌后应为标识符
任何将我的倒计时数字设置为图像的替代方法。实际上,您有两个
start()
调用,两个调用看起来都是错误的
试试这个
CountDownTimer ct=new CountDownTimer(3000, 1000) {
public void onTick(long millisUntilFinished) {
AnimationDrawable loadingAnimaton;
loadingAnimation = (AnimationDrawable) ImageView.getBackground();
loadingAnimation.start();
}
}
ct.start();