How to make DialogFragment width to Fill_Parent

前端 未结 18 2509
栀梦
栀梦 2020-12-04 08:21

I am working on an android application where I am using DialogFragment to display the dialog but its width is very small. How I can make this width to fil

18条回答
  •  感情败类
    2020-12-04 08:51

    Create a custom style in your style.xml file. Just copy paste this code into your style.xml file

    
    

    Then in the createDialog method of your DialogFragment, create the dialog object by the code

     dialog = new Dialog(getActivity(), R.style.CustomDialog);
    

    This is working for me and hope this will help you too

提交回复
热议问题