不允许使用java Android动画字符串类型
我为我的应用程序创建了一个动画资源,但是在构建它时,它声称所有属性都是“string types are not allowed
”。我在sdk 20上编译,最小值为14,目标值为20
为动画配乐。xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:interpolator="@安卓:anim/accelerate_decelerate_interpolator"
安卓:shareInterpolator="true"
安卓:ordering="sequentially">
<set>
<alpha
安卓:duration="300"
安卓:fromAlpha="0f"
安卓:toAlpha="1f" />
<scale
安卓:duration="300"
安卓:fromXScale="0.4f"
安卓:fromYScale="0.4f"
安卓:pivotX="50%"
安卓:pivotY="50%"
安卓:toXScale="1.0f"
安卓:toYScale="1.0f" />
</set>
<alpha
安卓:duration="300"
安卓:fromAlpha="1f"
安卓:startOffset="600"
安卓: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 楼答案
我真傻发现它不喜欢附加的
f
,所以将它们删除(1.0f
到1.0
等)解决了问题