ObjectAnimator with scale property makes bg black?

后端 未结 3 1121
青春惊慌失措
青春惊慌失措 2021-01-04 17:16

I use ObjectAnimator to scale down a RelativeLayout :

            ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(view, \"scaleX\", 0.5f);
            Obj         


        
3条回答
  •  Happy的楠姐
    2021-01-04 18:19

    As stated in the comments, the approach for creating an ObjectAnimator is to use the View's static Property object instead of passing the string since using the string value involves reflection for the setter and optionally for the getter in order to derive the starting value of the attribute. This is available from API 14

    ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(view, View.SCALE_X, 0.5f);
    ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.5f);
    

    A complete explanation can be found in DevBytes: Property Animations video by Google's engineer Chet Haase

提交回复
热议问题