Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.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 - Fatal编程技术网

Android 进度条自定义图像旋转动画

Android 进度条自定义图像旋转动画,android,Android,我试图使用自定义图像作为进度条,并希望旋转它。我试图通过这里的一个答案来实现,但是rotate\u animation.xml中的元素出现错误。我知道rotate元素应该在anim或animation文件夹中,但不知道如何在rotate\u animation.xml或任何可以旋转进度条图像的地方使用它 错误 Android资源链接失败 ../app/src/main/res/drawable/rotate\u animation.xml:8:错误:资源 找不到可拉伸/加载(又名com.exam

我试图使用自定义图像作为进度条,并希望旋转它。我试图通过这里的一个答案来实现,但是rotate\u animation.xml中的
元素出现错误。我知道
rotate
元素应该在
anim
animation
文件夹中,但不知道如何在
rotate\u animation.xml
或任何可以旋转进度条图像的地方使用它

错误 Android资源链接失败 ../app/src/main/res/drawable/rotate\u animation.xml:8:错误:资源 找不到可拉伸/加载(又名com.example:drawable/load)。错误:失败 链接文件资源

进度条

抽绳 rotate_animation.xml

progress\u undeterminate.xml

试试这个

    <?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">

    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item android:duration="50">

        <rotate xmlns:android="http://schemas.android.com/apk/res/android"
            android:drawable="@drawable/ic_fav"
            android:fromDegrees="330"
            android:pivotX="50%"
            android:pivotY="50%"
            android:repeatCount="1"
            android:toDegrees="360" />

    </item>


</animation-list>


关于
可拉伸/加载
呢?@Basi哦,我没能更改它。让我试试看。嘿,Nilesh,谢谢,但是在log
标记中出现此错误时崩溃需要一个“duration”属性
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">

    <item android:drawable="@drawable/ic_loader" android:duration="50" />
    <item android:drawable="@drawable/ic_loader" android:duration="50" />
    <item android:drawable="@drawable/ic_loader" android:duration="50" />

    <!-- this one is giving error -->
    <rotate
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:drawable="@drawable/load"
        android:pivotX="50%"
        android:pivotY="50%"
        android:fromDegrees="330"
        android:toDegrees="360"
        android:repeatCount="1" />

</animation-list>
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/rotate_animation"
    android:pivotX="50%"
    android:pivotY="50%" />
    <?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">

    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item
        android:drawable="@drawable/dishu"
        android:duration="50" />
    <item android:duration="50">

        <rotate xmlns:android="http://schemas.android.com/apk/res/android"
            android:drawable="@drawable/ic_fav"
            android:fromDegrees="330"
            android:pivotX="50%"
            android:pivotY="50%"
            android:repeatCount="1"
            android:toDegrees="360" />

    </item>


</animation-list>