How to I create a 100% custom DialogFragment

前端 未结 2 1260
南方客
南方客 2021-02-13 13:26

I want to have an Android dialog using Fragments that is fully customized: none of the platform dialog theme pieces are included. For example, something like this:

2条回答
  •  后悔当初
    2021-02-13 14:05

    Code below will help you to display full screen dialog and it also set transparent color

    Dialog dialog = new Dialog(this);
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // layout to display
    dialog.setContentView(R.layout.about_program_dialog_layout);
    
    // set color transpartent
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    
    dialog.show();
    

    about_program_dialog_layout.xml

    
    
    
        

提交回复
热议问题