Android get full width for custom Dialog

后端 未结 16 693
慢半拍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:51

    Two ways this can be done, first one in style.xml and second in code:

    1. Add as below in style.xml, alter the value(currently 90%) to meet your needs.
    
    
    1. Add setlayout to match_parent
     final Dialog contacts_dialog = new Dialog(ActivityGroup.this,
     R.style.theme_sms_receive_dialog);
     contacts_dialog.setContentView(R.layout.dialog_schedule_date_time);
    
    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    
     contacts_dialog.setCancelable(true);
     contacts_dialog.setCanceledOnTouchOutside(true);
     contacts_dialog.show();
    

提交回复
热议问题