簡體   English   中英

Android動畫-不允許使用字符串類型

[英]Android Animation - String types not allowed

我為我的應用創建了一個動畫資源,但是在構建它時聲稱所有屬性string types are not allowedstring types are not allowed ”。 我正在以20的sdk進行編譯,最低為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').

傻我! 原來,它不喜歡附加的f因此刪除它們(從1.0f1.0等)解決了問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM