I am trying to use some propertyValuesHolder with objectAnimator in an animation that I defined in XML. When I load it, an exception from the runtime is thrown with the reason Unknown animator name: propertyValuesHolder
This is a complete animation taken directly from objectAnimator docs here :
<?xml version="1.0" encoding="utf-8"?> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:repeatCount="1" android:repeatMode="reverse"> <propertyValuesHolder android:propertyName="x" android:valueTo="400"/> <propertyValuesHolder android:propertyName="y" android:valueTo="200"/> </objectAnimator>
I use the following code to download and run the animation:
Animator animator = AnimatorInflater.loadAnimator(getApplicationContext(), R.animator.example); animator.setTarget(view); animator.start();
I get the following from stacktrace:
Caused by: java.lang.RuntimeException: Unknown animator name: propertyValuesHolder at android.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:592) at android.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:551) at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:122) at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:102) at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:87)
This works when I use an animation that does not contain propertyValuesHolder . I cannot find examples on the Internet where this tag is used in XML. Am I doing something wrong or just not working?
source share