我找到了完美的答案。
使用这个链接,我找到了圆形进度环。
然后我使用了这段代码:
animation.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/progress_bar"
android:pivotX="50%"
android:pivotY="50%" />
在我的主XML文件中。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ProgressBar
android:id="@+id/progressbar1"
android:layout_marginTop="80dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@anim/animation"/>
</RelativeLayout>
最后的输出是:
AccelerateDecelerateInterpolator
,它会以缓慢-快速-缓慢的模式进行动画。 - Xaver Kapeller您可以使用gifView库:https://github.com/koral--/android-gif-drawable
在您的.xml文件中使用以下代码:
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/src_anim"
/>
其中src_anim是您的加载器gif文件