我想从我的屏幕中心到我的屏幕左上角翻译一个对象。翻译动画坐标发布多个设备
我希望翻译动画在所有设备上都是相同的 目前我给出的翻译值在不同的设备上[对象的动画位置不同]之后是不同的。
有没有办法来翻译和传递值,这将导致动画跨设备相同?
我的代码
ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(progressWidget, "scaleX", 0.355f);
ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(progressWidget, "scaleY", 0.355f);
scaleDownX.setDuration(3000);
scaleDownY.setDuration(3000);
ObjectAnimator translateX = ObjectAnimator.ofFloat(progressWidget, "translationX", -435f);
translateX.setRepeatCount(0);
translateX.setDuration(3000);
ObjectAnimator translateY = ObjectAnimator.ofFloat(progressWidget, "translationY", -295f);
translateY.setRepeatCount(0);
translateY.setDuration(3000);
//sequential animation
AnimatorSet set = new AnimatorSet();
set.play(scaleDownX).with(scaleDownY).with(translateX).with(translateY);
//set.start();
嘿感谢,如果没有太多的麻烦,你能解释一下你的代码段是干什么的? – ViVekH
添加一些解释 –
不工作,doesnt去顶边(0,0),为什么-location [0]? – ViVekH