简体   繁体   English

Android状态栏 - 它可以透明吗?

[英]Android status bar - can it be transparent?

Can Android status bar be transparent like in iOS? Android状态栏可以像iOS一样透明吗? I want it to blend into activity like on iOS. 我希望它融入iOS上的活动。 Can it be done and if yes - how? 可以这样做,如果是的话 - 如何?

EDIT: Just to clarify I need to make status bar transparent, not action bar, and yes I know I can completely hide it - but that's not what I'm asking. 编辑:只是为了澄清我需要使状态栏透明,而不是动作栏,是的我知道我可以完全隐藏它 - 但这不是我要求的。

No you can't make the system status bar transparent, and shouldn't try to do so in an attempt to mimic iOS : 不,你不能使系统状态栏透明,并且不应该试图模仿iOS

Don't mimic UI elements from other platforms 不要模仿其他平台的UI元素

Android 4.4 KitKit now allows translucent status and navigation bars: Android 4.4 KitKit现在允许半透明状态和导航栏:

http://developer.android.com/about/versions/android-4.4.html#UI http://developer.android.com/about/versions/android-4.4.html#UI

For example, you can set the theme as Theme.Holo.NoActionBar.TranslucentDecor. 例如,您可以将主题设置为Theme.Holo.NoActionBar.TranslucentDecor。

You can make your activity fullscreen so you won't see the status bar. 您可以全屏显示活动,这样您就不会看到状态栏。

Like this : 像这样 :

 requestWindowFeature(Window.FEATURE_NO_TITLE);
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 WindowManager.LayoutParams.FLAG_FULLSCREEN);

 setContentView(R.layout.main);

Or set a theme like this 或者设置这样的主题

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

It can be done. 可以办到。

Take a look at the following library which basically implements a fading action bar, starting from fully transparent. 看看下面的库,它基本上实现了一个淡入淡出的动作栏,从完全透明开始。

https://github.com/ManuelPeinado/FadingActionBar https://github.com/ManuelPeinado/FadingActionBar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM