Reputation: 1388
Inside my res/animator/backward.xml file, how can I acess a value from res/values/dimens.xml ?
<translate
android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="@dimen/anim_time"
/>
values file:
<resources>
<integer name = "anim_time">500</integer>
</resources>
Upvotes: 0
Views: 240
Reputation: 12643
Your problem is access integer value as dimen. Below code will work without any issue:
<translate
android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="@integer/anim_time" />
Please refer to AnimationDrawable docs about duration
attribute:
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
So, if your value is integer it's type should be integer
. Actually, dimens values are not allowed per above documentation.
Upvotes: 1