如何在Android中创建像Image一样的进度条

Har*_*had 7 android android-widget android-layout progress-bar

如何在我的Android应用程序中创建以下图像类型的进度环.我希望在我的整个应用程序加载到设备之前显示它10秒.而且我想旋转它.像窗口设备旋转.任何帮助表示赞赏.我是Andorid的新手.

图片 :

在此输入图像描述

Har*_*had 10

我得到了完美的答案.

使用此链接,我找到了圆形进度环.

progress_bar.gif

然后我使用此代码:

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%" />
Run Code Online (Sandbox Code Playgroud)

在我的主要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>
Run Code Online (Sandbox Code Playgroud)

最后输出是:

在此输入图像描述


Col*_*ire 5

u 可以使用 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"
    />
Run Code Online (Sandbox Code Playgroud)

其中 src_anim 是您的加载程序 gif 文件