问题
The setDuration function of the ObjectAnimator
class in Android appears to be completely ignored. No matter what value I pass it, the animation is always completed instantly.
ObjectAnimator.ofFloat(mView, "translationY", 0, 100)
.setDuration(2000)
.start();
The above code increases the Y value of mView
by 100 (essentially pushing it further down the screen). The actual translation occurs correctly, however it is instantaneous. The setDuration(2000)
is completely ignored. Why is this?
EDIT:
This seemsto be based on the device - the samsung galaxy s4 appears to have an issue with interpolating views correctly. This is the same issue as this question.
回答1:
This turned out to be an issue with the default animation duration scale under Developer Options. I've answered a similar question here.
来源:https://stackoverflow.com/questions/30377184/objectanimator-setduration-is-ignored