I use this code to create a custom AlertDialog:
val dialog = AlertDialog.Builder(context)
.setView(R.layout.layout)
.create()
The problem is I cannot get the inflated view. dialog.findViewById(R.id.a_view_in_the_layout)
returns null.
Alternatively, I can use .setView(View.inflate(context, R.layout.layout, null)
but this sometimes makes the dialog fill the screen and take more space than setView(int layoutResId)
.