在android中实现图像循环
如果有人可以帮助我,我想实现我的 Android 游戏的循环
,我已经在图像视图上加载了随机图像。
现在我想将图像从屏幕左下角加速到屏幕中心,形成 45 度角。到达窥视点后,它应该在右下角下降,形成 45 度角。
我的代码是
int[] imageView = {
R.id.imageV
};
int[] images ={
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4
};
Random rand=new Random();
for(int v : imageView) {
ImageView iv = (ImageView)findViewById(v);
iv.setImageResource(images[rand.nextInt(images.length)]);
}
I want to implement the loop of my android game if some body could help me
I have loaded random images on image view.
Now i want to accelerate my image from bottom left of screen to center of screen making an angle of 45 degrees.after reaching the peek it should come down at the bottom right corner making 45 degrees angle..
my code is
int[] imageView = {
R.id.imageV
};
int[] images ={
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4
};
Random rand=new Random();
for(int v : imageView) {
ImageView iv = (ImageView)findViewById(v);
iv.setImageResource(images[rand.nextInt(images.length)]);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先查看文档,然后尝试自己制作。如果不能,请返回您的代码,我们可以帮助您修复错误。
基本上,您应该使视图运行各种动画(移动和旋转)并将它们添加到动画集中。
https://developer.android.com/guide/topics/graphics/animation。 html
https://developer.android.com/guide/topics/resources/animation-resource.html
https://developer.android.com/reference/android/view/animation/package-summary.html
First check the docs, and try to make it by yourself. If you can't, come back with your code and we can help you to fix the error.
Basically you should make the view to run various animations (move and rotate) and add them in an animation set.
https://developer.android.com/guide/topics/graphics/animation.html
https://developer.android.com/guide/topics/resources/animation-resource.html
https://developer.android.com/reference/android/view/animation/package-summary.html