Question

Full Edit since it apparently wasn't clear that this is indeed a programming question

On the Galaxy S4, the notification bar is transparent by default. When using the built-in "Bubbles" wallpaper this looks as follows for example:

notification bar with bubbles wallpaper

Now I have developed my own live wallpaper. For sake of simplicity, I just fill the available canvas with 0xFFFF0000 for the screenshots, but normally it shows a different scene. On the Galaxy S4, my wallpaper does not show a transparent notification bar, but the default black one:

notification bar with my wallpaper

I noticed that sometimes my wallpaper shows a transparent bar also, here on the lockscreen. However, I was unable to reliably reproduce the behaviour.

my wallpaper transparent bar

My question is simply: is there any way to reliably enable the transparent notification bar from my wallpaper code or manifest? Actually, the unpredictable switching between transparent and black bar makes the user experience much worse than just with an always-black bar.

Was it helpful?

Solution

This is indeed possible on an unrooted S4:

public static boolean setTransparentNotificationBarTouchWiz(View view) {
    try {
        Field field = View.class.getDeclaredField("SYSTEM_UI_FLAG_TRANSPARENT_BACKGROUND");
        Class<?> t = field.getType();
        if (t == int.class) {
            int value = field.getInt(null);
            view.setSystemUiVisibility(value);
            return true;
        }
    } catch (NoSuchFieldException e) {
    } catch (IllegalAccessException e) {
    }

    return false;
}

My thanks to Kevin @ TeslaCoil for sharing this flag with me.

OTHER TIPS

Sorry, unless you are making a custom ROM this isn't possible, unless you only want the status bar changed for your app.

This would require a heck of a lot of work.

First you will need to add Theme.NoTitleBar.Fullscreen to your manifest

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" 
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    >

Then once you have done that you need to create a standard layout which represents the status bar, this would mean that you have to add the time, and also receive all the notifications from other apps, I do not personally know how to do that but I'm sure there is a way.

If you really want to do this goodluck, you have a hard time ahead of you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top