2015-04-06 101 views
0

我想将动画应用于线性布局的图像视图。我想在后台随机移动图像。随机移动背景图像

我的代码是

ImageView image1; 
private Animation animation,animation1,animation2,animation3,animation4; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.categories); 

    image1 = (ImageView) findViewById(R.id.image); 

    Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.zoomin); 
    image1.startAnimation(hyperspaceJumpAnimation); 

我得到这个错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{hunt.gilpix.wallpaper/hunt.gilpix.wallpaper.Categories}: java.lang.ClassCastException: hunt.gilpix.wallpaper.Categories cannot be cast to android.view.animation.Animation$AnimationListener 

回答

0

嘛!信息不足以回答! 告诉你到底想要做什么! 反正你可以试试这个:确定你想要展示多少张图片!把它放在可绘制的文件夹中。在你的Java文件拉全部在一个int数组! 和使用线程你可以随机更改! (想想一个随机数生成的想法)..

+0

不是,我想要在背景中使用单个图像和缩放临时工,并在缩放后,向右,向左,向下或向上移动。 – Hunt