is this syntax possible in android XML data binding?
"@{isRegistration ?
<EditText .......} :
<TextView.......
"
I not so sure if this syntax is now possible since data binding is now offering this kind of flexibility in
View.visibility
Thank you in advance.
CodePudding user response:
No, because the xml is inflated once. It wouldn't match changes in data. But what you can do is create both of those items, put them in the same place (relative to its parent), and set the visibility on the EditText to GONE is isRegistration is false and VISIBLE if true, and the opposite way on the TextView. This gets the same effect- both views will exist, in the same place, but only one will be visible.