【问题标题】:Animate a Chat Head为聊天头设置动画
【发布时间】:2014-10-06 14:54:55
【问题描述】:

我正在开发一个应用程序来显示聊天头。
我必须在聊天头上实现翻译动画,但它没有动画。

TranslateAnimation trans = new TranslateAnimation(0, 
    windowManager.getDefaultDisplay().getWidth() / 2, 0, 
    windowManager.getDefaultDisplay().getHeight());
trans.setFillAfter(false);
trans.setDuration(1000);
view.setAnimation(trans);

trans.setAnimationListener(new AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {

    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationEnd(Animation animation) {

    }
});

【问题讨论】:

  • 你还没有startAnimation

标签: android android-animation translate-animation


【解决方案1】:

你必须start animation查看:

view.startAnimation(trans);

【讨论】:

  • 我已经使用了开始动画。那个聊天头需要在屏幕顶部移动,使用翻译。
  • 根据您的代码,您使用了 setAnimation 方法。
  • 尝试将fill after设置为true
  • 我也使用了设置过滤器。当我制作另一个项目时,该动画代码运行良好,但不能在聊天头上工作(所有应用程序上的浮动窗口)。我需要像链接气泡应用程序一样。
  • 您确定“聊天头”可见并位于其他视图之上吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-21
  • 1970-01-01
相关资源
最近更新 更多