0

I am trying to display a dialog fragment embeded inside another fragment but whenever it shows, There is a plain white background at the top occupying the space where the action bar normally goes.

How do i display full screen of the dialog?

Here is my dialog fragment.

public class HelpDialog extends DialogFragment {


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.dialog, container, false);

        return view;
    }

    @Override
    public void onStart() {
        super.onStart();

        Dialog dialog = getDialog();
        if (dialog != null) {
            dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            dialog.getWindow().setBackgroundDrawable(null);
            setStyle(STYLE_NO_FRAME, android.R.style.Theme_Black_NoTitleBar_Fullscreen);

        }
    }
}

I have simple shown the dialog like this.

HelpDialog = new HelpDialog();
HelpDialog.show(fragmentManager, null);
Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
Jono
  • 17,341
  • 48
  • 135
  • 217

1 Answers1

1

replace setstyle with this

dialog.getWindow().requestWindowFeature(Window.FEATURE_NO_TITLE);

And put before

dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
Dharmaraj
  • 1,256
  • 13
  • 12