动作栏动画显示动作 [英] Animation for action bar show action

查看:70
本文介绍了动作栏动画显示动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将android 4.2与最新版本的appCompat一起使用.我已经使用以下方法实现了显示和隐藏操作栏的方法:

I'm using android 4.2 with appCompat of the latest version. I've implemented showing and hiding my action bar with these methods:

final ActionBar actionBar = getSupportActionBar();
actionBar.hide();
actionBar.show();

隐藏操作栏时,它会随着平滑的动画逐渐向上滑动而隐藏.但是,当我显示它时,它几乎立即出现在屏幕上,几乎没有平滑的动画向下滑动.我有什么方法可以配置它以使其在隐藏时顺利显示?

When action bar is being hide, it does so with smooth animation gradually sliding up. However, when I show it it appears on the screen almost instantly, almost without smooth animation sliding down. Is there any way I can configure it to show smoothly as it happens with hiding it?

推荐答案

尝试启用ActionBar隐藏/显示动画,默认情况下无法启用,因此请使用以下代码启用隐藏/显示动画:

Try to enable ActionBar hide/shown animation which is by deafult not enable so enable hide/shown animation using below code :

actionBar.setShowHideAnimationEnabled(boolean enabled);

这篇关于动作栏动画显示动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆