这个问题很老了。我的回答可能会对未来的读者有所帮助。
制作像提问者展示的那样的动画非常简单。我们自己可以创建如图所示的动画。首先,创建一个 VectorDrawable。例如下面:
my_vector_drawable.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="800.0"
android:viewportHeight="800.0">
<path
android:name="a_circle"
android:pathData="M 250 200
q -86 02 -140 57.5
t -57 135.5
q -03 93 67 156
q 59 52 135 50
q 71 -02 132 -54
q 66 -56 66 -146
q 00 -80 -45 -129
q -68 -72 -158 -70 "
android:strokeLineCap="round"
android:strokeColor="#f00f"
android:fillColor="#00000000"
android:trimPathEnd="0"
android:strokeWidth="32"/>
</vector>
my_animated_vector_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:drawable="@drawable/my_vector_drawable">
<target
android:name="a_circle"
android:animation="@animator/my_animation"/>
</animated-vector>
my_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:propertyName="trimPathEnd"
android:duration="1000"
android:valueFrom="0"
android:valueTo="1"
android:repeatCount="0"
android:repeatMode="restart"/>
</set>
第一个文件包含图片数据。第三个文件包含动画数据。第二个文件链接第一个和第二个。
您可以创建三个空白文件。将上面给出的内容复制并粘贴到您的文件中。
您将前两个文件放在可绘制文件夹中。第三个放在“animator”文件夹中。这两个文件夹都在 res 文件夹中找到了位置。
您可以创建一个包含 ImageView 的布局文件。您可以将 AnimatedVectorDrawable 文件作为可绘制对象 (android:src="my_animated_vector_drawable")。
在您的活动中将内容视图设置为布局。另外,给 ImageView 充气。
(myImage=((ImageView)findViewById(R.id.yourimageview name);
myImage.getDrawable.start():
然后看看乐趣。 AnimatedVectorDrawable 文件中可以有多个目标。在set下的动画文件中可以有多个ObjectAnimator...
您问题中显示的动画是路径变形。文档中也有路径变形示例,这也很简单。我把它留给你去试验。