【问题标题】:How to show hidden toolbar with animation?如何用动画显示隐藏的工具栏?
【发布时间】:2015-07-25 03:48:55
【问题描述】:

我想通过单击按钮显示带有动画的隐藏工具栏。我找到了一个很好的隐藏然后显示工具栏的代码:

隐藏:

toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start();

显示:

toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();

但我需要首先显示工具栏,所以在我开始动画时它应该被隐藏。

我将不胜感激。

【问题讨论】:

  • 应用程序启动时使用显示代码,动画结束时显示隐藏代码/

标签: android animation show toolbar


【解决方案1】:

在开始动画之前在简历上显示操作栏:

如果您使用的是 appcompat 库,

getSupportActionBar().hide();

否则

getActionBar().hide();

【讨论】:

  • 我不明白你的意思。在这种情况下工具栏的可见性必须是不可见的?
  • 糟糕,我以为您希望它默认可见。编辑了答案。
猜你喜欢
  • 1970-01-01
  • 2011-07-06
  • 2023-03-26
  • 2011-05-17
  • 2012-01-07
  • 1970-01-01
  • 2014-12-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多