Skip to content
Advertisement

How to set visibility for include layout in databinding?

I have implemented data binding in my project. I have a particular screen with two nested layouts in include tags. I couldn’t change the visibility for include layouts using data binding programmatically.

However, I have achieved it through a boolean, but my question is how to set visibility for that include tag programmatically.

My xml:

JavaScript

And in Activity: when I try to set this – it becomes red meaning it doesn’t take it as a view.

JavaScript

Advertisement

Answer

add get root to your view

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement