动作条或ActionBarSherlock - 顺利隐藏/显示动作条 [英] ActionBar or ActionBarSherlock - Smoothly Hide / Show the ActionBar

查看:193
本文介绍了动作条或ActionBarSherlock - 顺利隐藏/显示动作条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ActionBarSherlock ,并试图隐藏/显示动作条的全屏图像,使用:

I'm using ActionBarSherlock, and attempting to hide / show the ActionBar for fullscreen images, using:

getSupportActionBar.hide();

getSupportActionBar.show();

但它是真的跳动和尴尬。有什么办法能让它更顺畅,或申请翻译/不透明度动画?

But it is really jumpy and awkward. Is there a way to make it smoother, or to apply a translation / opacity animation?

当ABS源的进一步检查,并通过观察其行为,它似乎已经定义动画的至少最小量。同样不能说是为标准的ActionBar

Upon further inspection of ABS source, and through observing its behavior, it seems to have at least a minimal amount of animation defined. The same cannot be said for the standard ActionBar.

只是为了完整性,这里是有关code,我呼吁从ImageView.click:

Just for completeness, here is the relevant code I'm call from an ImageView.click:

if( shouldRender )
{
  . . .

  getSupportActionBar().hide();

  getWindow().addFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN );
}
else
{
  . . .

  getSupportActionBar().show();

  getWindow().clearFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN );
}

值得一提的是,标志设置/结算也导致跳转,而是一个更引人注目的一个,所以我打算以后解决它,如果在​​所有。

It's worth noting that the flags setting / clearing also causes a jump, but a much less noticeable one, so I was going to tackle it later, if at all.

编辑: (由ABS的创建者)似乎指出,这是不可能的在本机动作条。我想我可以只修改定义了动画中的两个XML文件,但是这不会给我完全的平台渗透。

This (by the creator of ABS) seems to state that it's impossible on a native ActionBar. I suppose I could just edit the two XML files that define his animation, but that will not give me full platform penetration.

推荐答案

我用一个覆盖动作条

 requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌​AY);

它不显示动画时,显示() / 隐藏()

这篇关于动作条或ActionBarSherlock - 顺利隐藏/显示动作条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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