TextView disappears after animation on some device

2019-08-19 08:25发布

问题:

I have this animation code which rotate TextView by 360 after some action. On most part of devices it works well but on some of them the view disappears after the animation

I can't reproduce the bug locally on phone or emulator but have some video recordings from users who reported bug on Google play.

Some devices with this problem: Huawei 荣耀畅玩 6X honor6x, HUAWEIMate9lite, Huawei Honor 8

Link to video https://youtu.be/HwjlDjtuE1A

@BindingAdapter("animateView")
public static void setAnimateView(TextView textView, boolean animateView) {
    String prevText = textView2value.get(textView);
    String text = textView.getText().toString();
    if (animateView && (prevText != null && !prevText.isEmpty()) && text.isEmpty()) {
        textView.setRotationX(0);
        textView.animate()
                .rotationX(360)
                .setDuration(500)
                .start();
    }
    if (!textView.getText().toString().equals(prevText)) {
        textView2value.put(textView, text);
    }
}