Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 设置图像部分的动画_Android_Animation - Fatal编程技术网

Android 设置图像部分的动画

Android 设置图像部分的动画,android,animation,Android,Animation,在我的学士学位论文中,我正在创造一种可穿戴设备,用于检测它在身体上的位置。 它通过BLE连接到Android设备,并告诉手机它放在哪里 现在,我想显示一张身体的地图,并设置一个闪烁的点的动画,我从现在起在指示灯中调用它,或者在身体上放置可穿戴设备的地方。它可能是身体不同部位的多个装置。如果一个新设备被放置在身体上,它应该在身体地图上闪烁 我读到过一些不切实际的东西,因为我需要创建太多不同的框架。一开始听起来不错,但我需要了解每一个指标。我也尝试过用画布来制作动画,但是我需要重新绘制很多才能得到好

在我的学士学位论文中,我正在创造一种可穿戴设备,用于检测它在身体上的位置。 它通过BLE连接到Android设备,并告诉手机它放在哪里

现在,我想显示一张身体的地图,并设置一个闪烁的点的动画,我从现在起在指示灯中调用它,或者在身体上放置可穿戴设备的地方。它可能是身体不同部位的多个装置。如果一个新设备被放置在身体上,它应该在身体地图上闪烁

我读到过一些不切实际的东西,因为我需要创建太多不同的框架。一开始听起来不错,但我需要了解每一个指标。我也尝试过用画布来制作动画,但是我需要重新绘制很多才能得到好的动画

我通常开发web前端,所以我认为可能只是将指示器绝对定位在背景图像上,然后告诉每个指示器是否应该可见或是否应该闪烁等,这将是一个好方法。所以我试着用一个图层列表来实现这一点,给每个图层列表一个id,然后我可以操纵每个图层列表。但我无法让它工作

我也可以使用OpenGL,但我想这会造成太多的开销

所以我的问题是,在背景图像上创建多个独立可控的东西的最佳方式是什么。有什么想法吗


提前感谢您的回答。

您可以在知道您提到的情况下使用SurfaceView,然后在SurfaceView上绘制身体的背景位图。那会给你身体

然后你要做的就是渲染这些点

请注意,如果这足够简单,您可能可以覆盖ImageView的onDraw,而不是使用后台线程实现SurfaceView


希望这能有所帮助,听起来像是一个有趣的项目。

我认为有一个绝对的布局,但在API级别3中它被弃用了

所以现在我要说:

这不是最好的,我想它的缺点和绝对布局差不多


我想,像%而不是dp这样的东西对于利润率来说是不错的。

这并不是我问题的答案。但我想这就是我要做的。
    <ImageView
        android:id="@+id/figure"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/man"
        android:layout_centerHorizontal="true"
        />
    <ImageView
        android:id="@+id/beSeen_arm_left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="80dp"
        android:layout_marginTop="120dp"
        android:clickable="true" />
    <ImageView
        android:id="@+id/beSeen_arm_right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="230dp"
        android:layout_marginTop="120dp"
        />
    <ImageView
        android:id="@+id/beSeen_forearm_left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="70dp"
        android:layout_marginTop="190dp"
        />
    <ImageView
        android:id="@+id/beSeen_forearm_right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="240dp"
        android:layout_marginTop="200dp"
        />
    <ImageView
        android:id="@+id/beSeen_back_top"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="160dp"
        android:layout_marginTop="90dp"
        />
    <ImageView
        android:id="@+id/beSeen_head"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher"
        android:layout_marginLeft="160dp"
        android:layout_marginTop="10dp"
        />

</RelativeLayout>