Luke
Luke

Reputation: 492

ActionBar under notification/title bar

I'm having an issue with the ActionBar in my app; In certain scenarios the ActionBar appears to go "under" the notifications/title bar. It's reproducible each time and i can't figure out why it's happening. I use the ZXING application with Intents to scan barcodes and return them to my app, and it's at some point during this process the issue occurs.

I thought it'd be best to show you the issue with pictures.

1: The app home screen, all is normal.

App home screen, no issues

2: Use the menu item to scan a barcode. This appears as expected.

Scan a product...

3: The product page for the scanned item appears normal. If i click 'Cancel' however...

Product page, all still normal. Press cancel...

4: The ActionBar has now gone under the notifications/title bar.

Home screen now shows the ActionBar under the notification/title bar

The only other mention of a bug such of this (that i can find) is in this GitHub issue for ActionBarSherlock (which i'm using): https://github.com/JakeWharton/ActionBarSherlock/issues/602

I have checked and i'm not doing anything weird with configChanges as Jake mentions.

This issue is seen on my 4.2.2 device, i'm unable to test on a pre-ICS device unfortunately.

Any thoughts or suggestions are welcome!

Upvotes: 4

Views: 597

Answers (1)

petey
petey

Reputation: 17140

I'm guessing it not getting reset back when you come back from the zxing screen. In your Activity for "Best Before", try reseting the window flags for fullscreen something like:

@Override
protected void onResume() {
    super.onResume();
    //getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setSystemUiVisibility(this, View.SYSTEM_UI_FLAG_VISIBLE /* SYSTEM_UI_FLAG_VISIBLE=0 */);
}



private static void setSystemUiVisibility(final Activity activity, final int newValue){
    if (activity.getWindow() != null){
        View v = activity.getWindow().getDecorView();
        if (v != null) {
            try {
                Method methodSetSystemUIVisibility = v.getClass().getMethod("setSystemUiVisibility", int.class);
                methodSetSystemUIVisibility.invoke(v, newValue);
            } catch (Exception noop) {
            }
        }
    }
}

Upvotes: 2

Related Questions