[英]Move Background image randomly
I want to apply animation to the imageview in linear layout. 我想将动画应用于线性布局的imageview中。 I want to move image randomly in background. 我想在背景中随机移动图像。
My code is 我的代码是
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);
I got this error : 我收到此错误:
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
Well! 好! Insufficient info to answer!! 信息不足,无法回答! Tell was what exactly u want to do! 告诉你你到底想干什么! Anyways u can try this: determine how many images u wanna show! 无论如何,您都可以尝试:确定您要显示多少张图片! Put it in drawable folder. 将其放在可绘制的文件夹中。 In ur java file pull all that in a int array! 在您的java文件中,将所有内容拉入int数组! And using thread u can it can randomly change!! 使用线程你可以随机改变! (Think of a random num generating idea) .. (考虑随机数生成的想法)..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.