Reputation: 523
I have an ActionBar in my app (via the v7 compat library) and it works just fine. When I bring up a DialogFragment though, the overflow menu appears behind the dialog. I was expecting the ActionBar to always be on top. Needless to say, this disrupts input into the ActionBar.
Here's the code to display the fragment - pretty standard stuff
CChildDialog dlg = createDialog(id,args);
if (dlg != null) {
// now display the fragment!
// DialogFragment.show() will take care of adding the fragment
// in a transaction. We also want to remove any currently showing
// dialog, so make our own transaction and take care of that here.
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag(dialogTag);
if (prev != null) {
ft.remove(prev);
}
// Create and show the dialog.
dlg.show(ft, dialogTag);
}
My dialog class doesn't do anything weird other than enable background clicks like so:
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Window dialogWindow = getDialog().getWindow();
// Make the dialog possible to be outside touch
dialogWindow.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
Upvotes: 0
Views: 748
Reputation: 35661
On the contrary, your dialog class does very weird things. You turn off the flags that make it a dialog.
The dialog appears on top of your activity (which includes your actionbar) therefore it is normal that a menu in your actionbar appears behind the dialog window. You have turned off the modal nature of the dialog otherwise you would not be able to activate the menu.
Upvotes: 1