Android get full width for custom Dialog

后端 未结 16 691
慢半拍i
慢半拍i 2020-12-02 15:19

in my application my created custom dialog dont have full height and i can not change and customize that.for example see this screen shot:

16条回答
  •  长情又很酷
    2020-12-02 15:38

    In case anyone is wondering how to do it for a dialog shown using DialogFragment, you can override onCreateDialog to return a Dialog with custom style that has windowMinWidthMajor and minor set to 90%

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        return new Dialog(getActivity(), R.style.WideDialog);
    }
    

    Style:

    
    

提交回复
热议问题