我们有使用View的属性动画。但是测试时发现,原本在Pad上运行良好的View动画,在目标平台上运行时会出现下列问题: 运行动画的View在动画过程中,View的一部分始终会被父View 所遮挡。
原因: 目标平台上调用View.bringToFront之后,父View没有自动刷新。
解决方法: 在调用View.bringToFront之后,将父View刷新
private AnimatorUpdateListener animationlistenr = new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float yPos = (Float) animation.getAnimatedValue();
textureView.bringToFront();
textureView.setY(yPos);
if (textureView.getParent() instanceof View) {
((View) textureView.getParent()).invalidate();
}
}
};