2013-02-16 69 views
0

这是我在countdowntimer中使用的代码。动画中的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) { 
    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; 
}}); 
} 
} 

--the错误我在loadingAnimation.start();获取说,令牌 语法错误“开始”,标识预计将设置我的倒计时数到的图像,此令牌

任何替代方法之后。

回答

0

其实你有2 start()调用,都看起来不对。

试试这个

 CountDownTimer ct=new CountDownTimer(3000, 1000) { 

     public void onTick(long millisUntilFinished) { 
     AnimationDrawable loadingAnimaton; 
     loadingAnimation = (AnimationDrawable) ImageView.getBackground(); 
     loadingAnimation.start(); 
    } 


    } 
    ct.start();