How to use ObjectAnimator for View property Y before sdk 14

52 views Asked by At

I'm trying to use ObjectAnimator to animate the "x" and "y" property of a view. It works great in api 14+, but I noticed that these properties were added to the view class in api 14. How do I get them to work pre api 14? I've considered the following but am stuck:

            ObjectAnimator y = new ObjectAnimator();
            Property<View, Float> yProperty;
            if(Build.VERSION.SDK_INT >= 14){yProperty = Property.of(View.class, Float.class, "y");}
            else{yProperty = Property.of(View.class, Float.class, "top");}
            y.setProperty(yProperty);
0

There are 0 answers