微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – ProgressDialog上更平滑,更快速的旋转

我有一个自定义动画到我的ProgressDialog,这是这样设置的:

pd.setIndeterminateDrawable(c.getResources().getDrawable(R.anim.progress_animation));

progress_animation是这样的:

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromdegrees="0"
    android:interpolator="@android:anim/linear_interpolator"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:todegrees="358" >

    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="8"
        android:useLevel="false" >
        <size
            android:height="48dip"
            android:width="48dip" />

        <gradient
            android:centerColor="#4c737373"
            android:centerY="0.50"
            android:endColor="#E66A0F"
            android:startColor="#4c737373"
            android:type="sweep"
            android:useLevel="false" />
    </shape>

</animated-rotate>

这将给我一个橙色旋转轮,但这似乎比ProgressDialog中的认旋转轮“更慢”或更滞后.我已经尝试将android:todegrees设置为360到358,但没有运气.我也启用了硬件加速.无论如何我可以让这个动画更流畅,更快?

谢谢!

解决方法:

使用“旋转”代替“动画旋转”并更改android:todegrees应该让它更快.

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@android:anim/linear_interpolator"
    android:pivotX="50%"
    android:pivotY="50%"
    android:todegrees="2160" />

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐