动画滞后?

时间:2018-03-16 08:35:04

标签: android animation lag

我创建了一个菜单,当我们点击一​​个按钮时它会打开,当我们点击另一个按钮时它会隐藏。这个菜单中有一个动画,我不明白为什么动画滞后(屏幕冻结,我们必须重新启动应用程序) 这是我的代码:

public void slideToBottom(View view) {
    TranslateAnimation animate = new TranslateAnimation(0f, 0f, 0f, view.getHeight());
    animate.setDuration(100);
    animate.setFillAfter(true);
    view.startAnimation(animate);
    view.setVisibility(View.GONE);
}

public void slideToTop(View view) {
    TranslateAnimation animate = new TranslateAnimation(0f, 0f, view.getHeight(), 0f);
    animate.setDuration(100);
    animate.setFillAfter(true);
    view.startAnimation(animate);
    view.setVisibility(View.VISIBLE);
}

注意:当我只保留view.setVisibility(View.VISIBLE);应用程序不会冻结。 你有解决这个问题的方法吗?谢谢

编辑:I Add My logs Here

0 个答案:

没有答案
相关问题