简体   繁体   中英

Android status bar - can it be transparent?

Can Android status bar be transparent like in iOS? I want it to blend into activity like on 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 :

Don't mimic UI elements from other platforms

Android 4.4 KitKit now allows translucent status and navigation bars:

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

For example, you can set the theme as 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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