As per http://developer.android.com/tools/data-binding/guide.html#imports, we can have such simple expressions in visibility:
<TextView
..
android:visibility="@{user.isAdult ? View.VISIBLE : View.GONE}"/>
But when I try to do the same in an include
tag, like so:
<include
android:id="@+id/image_layout"
layout="@layout/image_layout"
android:visibility="@{notification.notifType == 0 ? View.VISIBLE : View.GONE}"/>
Then Studio not only shows the expression in red, but upon building it gives the following error in the auto-generated binding class:
Error:(138, 29) error: cannot find symbol method setVisibility(int)
Here's where the error occurs in the auto-generated binding class
// batch finished
if ((dirtyFlags & 0x3L) != 0) {
// api target 1
this.imageLayout.setVisibility(NotifTypeNotificatio1);
}
imageLayout.executePendingBindings();