In the Android docs on AlertDialog, it gives the following instruction and example for setting a custom view in an AlertDialog:
If you want to display a
This worked for me:
dialog.setView(dialog.getLayoutInflater().inflate(R.layout.custom_dialog_layout, null));