[英]ActionBar or ActionBarSherlock - Smoothly Hide / Show the ActionBar
I'm using ActionBarSherlock , and attempting to hide / show the ActionBar for fullscreen images, using: 我正在使用ActionBarSherlock ,并试图隐藏/显示全屏图像的ActionBar,使用:
getSupportActionBar.hide();
and 和
getSupportActionBar.show();
But it is really jumpy and awkward. 但它真的很神奇,很尴尬。 Is there a way to make it smoother, or to apply a translation / opacity animation?
有没有办法让它更平滑,或应用翻译/不透明动画?
Upon further inspection of ABS source, and through observing its behavior, it seems to have at least a minimal amount of animation defined. 在进一步检查ABS源并通过观察其行为时,似乎至少定义了最少量的动画。 The same cannot be said for the standard ActionBar.
标准ActionBar也不能这样说。
Just for completeness, here is the relevant code I'm call from an ImageView.click: 为了完整起见,这是我从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. 值得注意的是,标志设置/清除也会导致跳跃,但不太明显,所以我稍后会解决它,如果有的话。
Edit: This (by the creator of ABS) seems to state that it's impossible on a native ActionBar. 编辑: 这 (由ABS的创建者)似乎表明在原生ActionBar上是不可能的。 I suppose I could just edit the two XML files that define his animation, but that will not give me full platform penetration.
我想我可以编辑定义他的动画的两个XML文件,但这不会给我完整的平台渗透。
I use an overlay ActionBar 我使用覆盖ActionBar
requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERLAY);
it doesn't show an animation when show()
/ hide()
is called. 调用
show()
/ hide()
时,它不显示动画。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.