【问题标题】:Implementing loop of images in android在android中实现图像循环
【发布时间】:2012-02-16 19:12:34
【问题描述】:

如果有人可以帮助我,我想实现我的 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)]);

        }

【问题讨论】:

  • 除了加载图像之外,您是否尝试过自己编写任何其他代码? Android上有很多动画和游戏开发的例子
  • 我已经搜索了很多这种循环,但还没有成功。你能解决这个问题吗
  • 其实这个问题你只需要逻辑实现。 Stackoverflow 并不是真正为用户设计的,让用户互相请求帮助他们实现一些他们自己不能(或不想)实现的逻辑。有 freelancer.com 处理这些事情。

标签: android android-layout loops cocos2d-android


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-30
    相关资源
    最近更新 更多