-1
我的應用程序中有一個ActionBar(通過v7 compat庫),它工作得很好。當我調出一個DialogFragment時,溢出菜單出現後面的對話框。我期待ActionBar始終處於頂峯。不用說,這會擾亂ActionBar的輸入。DialogFragment出現在ActionBar頂部
這裏的顯示片段中的代碼 - 非常標準的東西
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);
}
我的對話框類並沒有做任何事情奇怪除了啓用後臺點擊,像這樣:
@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);
}
如果我刪除'onViewCreated上的這些標誌,'我無法完全與ActionBar進行交互 – Paladine
這是對話窗口的要點。它持有焦點,直到你做了一些事情。如果你正在做你正在做的事情,你的用戶界面會很混亂和不標準。你需要重新考慮這一點。 – Kuffs
我真的想要一個無模式的對話方法,所以我會去調查'PopupWindow'來查看它是否像我期待的那樣 – Paladine