随机移动背景图像

时间:2015-04-06 22:00:06

标签: android animation android-activity

我想在线性布局中将动画应用于imageview。我想在背景中随机移动图像。

我的代码是

    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

1 个答案:

答案 0 :(得分:0)

嘛!回复信息不足!! 告诉你究竟想做什么! 无论如何你可以尝试这个:确定你想要显示多少图像!把它放在drawable文件夹中。在你的java文件中拉出int数组中的所有内容! 使用线程你可以随意改变!! (想想一个随机数生成的想法)..

相关问题