值动画师立即给出最大可能值

时间:2015-05-12 15:06:46

标签: android android-animation

我有价值动画师,我试图在我的活动中制作视图动画,并且它在我测试过的许多设备上完美运行,但Galaxy Note 3除外 当我运行我的代码时,它给了我最大的可能值

这是我的日志代码

public void slide_down(Context ctx, final View v) {
  Log.d("valueAnimator","slide_down");
  DisplayMetrics dm = new DisplayMetrics();
  AddEventActivity.this.getWindowManager().getDefaultDisplay().getMetrics(dm);
  final int hight = dm.heightPixels;
  ValueAnimator va = ValueAnimator.ofInt(0, hight - convertDpToPixel(228));
  va.setDuration(250);
  Log.d("valueAnimator","hight "+hight);
  Log.d("valueAnimator","va "+(hight - convertDpToPixel(228)));
  va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
   public void onAnimationUpdate(ValueAnimator animation) {
    Integer value = (Integer) animation.getAnimatedValue();
    v.getLayoutParams().height = value.intValue();
    v.requestLayout();
    Log.d("valueAnimator","value "+value);
   }
  });
  va.start();
 }

和日志

    D/valueAnimator(29832): slide_down
 D/valueAnimator(29832): hight 1920
 D/valueAnimator(29832): va 1236
 D/valueAnimator(29832): value 1236

从galaxy s4设备登录(正常状态)

    D/valueAnimator(22319): slide_down
D/valueAnimator(22319): hight 1920
D/valueAnimator(22319): va 1236
D/valueAnimator(22319): value 0
D/valueAnimator(22319): value 0
D/valueAnimator(22319): value 52
D/valueAnimator(22319): value 113
D/valueAnimator(22319): value 200
D/valueAnimator(22319): value 306
D/valueAnimator(22319): value 419
D/valueAnimator(22319): value 548
D/valueAnimator(22319): value 672
D/valueAnimator(22319): value 801
D/valueAnimator(22319): value 922
D/valueAnimator(22319): value 1023
D/valueAnimator(22319): value 1113
D/valueAnimator(22319): value 1180
D/valueAnimator(22319): value 1220
D/valueAnimator(22319): value 1235
D/valueAnimator(22319): value 1236

0 个答案:

没有答案