在某些设备上播放动画后,TextView消失

时间:2019-04-18 10:34:27

标签: java android animation rotation

我有这个动画代码,可以在执行某些操作后将TextView旋转360度。在大多数设备上,它运行良好,但在某些设备上,动画后视图消失了

我无法在手机或仿真器上本地复制该错误,但是有一些用户在Google Play上报告了该错误。

某些设备有此问题:华为荣耀畅玩6X Honor6x,HUAWEIMate9lite,Huawei Honor 8

链接到视频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);
    }
}

0 个答案:

没有答案