this is driving me nuts, so hoping someone can help.
I have a dialogfragment i am using to select from a list. I have this in fullscreen, and it has always worked prior to 11/ API 30. However, now in 11 it started appearing with the classic "not in fullscreen" look, where you can see the layout behind it on all four sides.
I got it working again by overriding the onCreateDialog method, see below. In that method, i basically duplicate the calls i already make in onStart() as you can see below...
My question is WHY DID I HAVE TO DO THIS? It works fine prior to version 11/30, and i haven't found any documentation that mentions any changes related to this in 11.
Would be great if someone more knowledgeable than me could help me understand.
new method i had to add:
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return dialog;
}
my onStart that made the window appear normal prior to 11:
public void onStart() {
super.onStart();
Window window = getDialog() != null ? getDialog().getWindow() : null;
if (window != null) {
if (windowAnimStyle > 0) {
window.getAttributes().windowAnimations = windowAnimStyle;
}
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
}