Android动画 - 不允许使用字符串类型

时间:2014-11-22 10:51:29

标签: java android

我为我的应用创建了一个动画资源,但是在构建它时声称所有属性都是“string types are not allowed”。我在sdk 20编译,最少14分,目标为20分。

score_animation.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_decelerate_interpolator"
    android:shareInterpolator="true"
    android:ordering="sequentially">
    <set>
        <alpha
            android:duration="300"
            android:fromAlpha="0f"
            android:toAlpha="1f" />
        <scale
            android:duration="300"
            android:fromXScale="0.4f"
            android:fromYScale="0.4f"
            android:pivotX="50%"
            android:pivotY="50%"
            android:toXScale="1.0f"
            android:toYScale="1.0f" />

    </set>
    <alpha
        android:duration="300"
        android:fromAlpha="1f"
        android:startOffset="600"
        android:toAlpha="0f" />
</set>

完整错误:

Error:(9, 32) String types not allowed (at 'fromAlpha' with value '0f').
Error:(10, 30) String types not allowed (at 'toAlpha' with value '1f').
Error:(13, 33) String types not allowed (at 'fromXScale' with value '0.4f').
Error:(14, 33) String types not allowed (at 'fromYScale' with value '0.4f').
Error:(17, 31) String types not allowed (at 'toXScale' with value '1.0f').
Error:(18, 31) String types not allowed (at 'toYScale' with value '1.0f').
Error:(23, 28) String types not allowed (at 'fromAlpha' with value '1f').
Error:(25, 26) String types not allowed (at 'toAlpha' with value '0f').

1 个答案:

答案 0 :(得分:7)

愚蠢的我!原来它不喜欢附加的f所以删除它们(1.0f1.0等)解决了这个问题。