2012-05-06 29 views
0

我有一张想慢慢淡入的图像;我玩过标准的动画结构,但它似乎从来没有工作。“淡入”图像的Alpha动画?

(用于图像:)

@Override 
    public void draw(Canvas c, Layer layer) { 
     if (layer == Layer.BACKGROUND) {    

      Animation a = new AlphaAnimation(1.00f, 0.00f); 
      a.setDuration(4000); 

      instructions.startAnimation(a); 

      location.left = (view.getWidth() - instructions.getMinimumWidth()) /2; 
      location.right = location.left + instructions.getMinimumWidth(); 
      location.top = view.getHeight()/2; 
      location.bottom = location.top + instructions.getMinimumHeight(); 
      instructions.setBounds(location); 
      instructions.draw(c); 
     } 
     //explosions.draw(c, layer); 
    } 
}; 

...代码 “startAnimation是未定义类型BitmapDrawable,” 它说。

回答

0

startAnimationView的方法,所以如果你有在ImageView实例imageView位图,你应该叫imageView.startAnimation(a);