Reputation: 492
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.
2: Use the menu item to scan a barcode. This appears as expected.
3: The product page for the scanned item appears normal. If i click 'Cancel' however...
4: The ActionBar has now gone under the notifications/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
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