Zaimplementowałem DataBinding
w Activity
, Fragment
i RecyclerView
. Teraz próbuje to zrobić w Dialog
, ale trochę mylić o tym, jak ustawić niestandardowy widok w nim?DataBinding z Androidem Dialog
Oto kod, który zaimplementowałem dla Dialog
.
Dialog dialog = new Dialog(context);
dialog.getWindow();
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
LayoutTermsBinding termsBinding;
dialog.setContentView(R.layout.layout_terms);
dialog.getWindow().setLayout(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
wiem, czy to jest Activity
możemy wykonać DataBindingUtil.setContentView()
i Fragment
możemy wykonać DataBindingUtil.inflate()
ale jestem mylić o tym, jak konwertować dialog.setContentView(R.layout.layout_terms);
z DataBinding
.
Interesujące pytanie. – pRaNaY
Dlaczego nie używasz DialogFragment? –