How to set button click listener for Custom Dialog?

后端 未结 7 430
遇见更好的自我
遇见更好的自我 2021-01-11 11:30

I have made a main Dialog class on which I send the layout ID and shows the layout as a Dialog now when I send the layout from calling class it pop

7条回答
  •  执念已碎
    2021-01-11 12:11

    dialog = new Dialog(this);
    dialog.setContentView(R.layout.custom_dialog);
    dialog.setTitle("Custom Dialog");
    
    
    Button dialog_btn = (Button) dialog.findViewById(R.id.dialog_button);
    dialog_btn.setOnClickListener(new View.OnClickListener() 
    {
        // Perform button logic
    }
    

提交回复
热议问题