Unable to get proper custom AlertDialog

后端 未结 2 504
广开言路
广开言路 2021-01-26 14:55

I have been trying to set a custom AlertDialog but was not able to get correctly.

prompt.xml




        
2条回答
  •  旧时难觅i
    2021-01-26 15:51

        Dialog d=new Dialog(this);
        //Add this
        d.requestWindowFeature(Window.FEATURE_NO_TITLE);
    
        d.setContentView(R.layout.prompt);
        WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
        lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        d.getWindow().setAttributes(lp);
        d.show();
    

提交回复
热议问题