public void animateScreenOn() {
CellLayout layout = (CellLayout) getChildAt(getCurrentPage());
if (layout != null) {
int count = layout.getPageChildCount();
for (int i = count-1; i>=0; i--) {
View v = layout.getPageChild(i);
v.setScaleX(0.95f);
v.setScaleY(0.95f);
AnimatorSet set = new AnimatorSet();
ObjectAnimator animation1 = LauncherAnimUtils.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat("scaleX", 1.0f));
animation1.setDuration(1000L);
animation1.setInterpolator(new BounceInterpolator());
ObjectAnimator animation2 = LauncherAnimUtils.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat("scaleY", 1.0f));
animation2.setDuration(500L);
animation2.setInterpolator(new BounceInterpolator());
List<Animator> items = new ArrayList<Animator>();
items.add(animation1);
items.add(animation2);
set.playTogether(items);
set.setStartDelay((count-1-i)*100L);
set.start();
}
}
}
此代码存在问题。这个代码成本的时间在不同的设备上是不同的,有些是可以的,但有些会太短,所以我需要根据设备刷新率更改动画时间。任何人都可以告诉我如何从Android代码中获取它,3X!