简体   繁体   中英

Android Animation - String types not allowed

I created an animation resource for my app, however when building it claims that " string types are not allowed " for all of the attributes. I'm compiling at sdk 20 with a min of 14 and target of 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>

Full error:

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').

Silly me! Turns out that it does not like the appended f so removing them ( 1.0f to 1.0 etc) solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM