I am having trouble in implementing databinding in a Dialog. Is it possible?
Below is my xml.
I tried @Dullahan's answer, however the dialog seemed to shrink strangely. So I tried another ways, finally found solution.
class CustomDialog(context: Context) : Dialog(context) {
private lateinit var binding: CustomDialogBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.custom_dialog)
binding = CustomDialogBinding.bind(findViewById(R.id.root))
}
}