Перенос масштабирования назад с помощью Nineoldandroids - метод не решен
Я пытаюсь перенести http://developer.android.com/training/animation/zoom.html обратно на API < 11.
Я использую библиотеку nineoldandroid для этого. Однако есть эта часть, которую не может понять
AnimatorSet set = new AnimatorSet();
set.play(ObjectAnimator
.ofFloat(expandedImageView, View.X, startBounds.left))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.Y, startBounds.top))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.SCALE_X, startScaleFinal))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.SCALE_Y, startScaleFinal));
Я сделал это в:
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left, finalBounds.left),
ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top, finalBounds.top),
ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScale, 1f),
ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScale, 1f)
);
Однако View.X, View.Y, View.SCALE_X и View.SCALE_Y не принимаются.
Должны ли они быть заменены строками "translationX", translationY"и"scaleX", "scaleY"?
1 ответ
Решение
Мое первоначальное предположение было верным, но playTogether не был необходим.
Это было решение:
set
.play(ObjectAnimator.ofFloat(expandedImageView, "translationX", startBounds.left, finalBounds.left))
.with(ObjectAnimator.ofFloat(expandedImageView, "translationY", startBounds.top, finalBounds.top))
.with(ObjectAnimator.ofFloat(expandedImageView, "scaleX", startScale, 1f))
.with(ObjectAnimator.ofFloat(expandedImageView, "scaleY", startScale, 1f));