Is it possible to reference colors from xml using databinding for android?
This works fine:
android:textColor="@{inputValue == null ? 0xFFFBC02D : 0xFFFFEB3B}"
but this does not:
android:textColor="@{inputValue == null ? @color/red : @color/blue}"
Reported it here: https://issuetracker.google.com/issues/38021292
* EDIT *
It turns out it was just and id issue / bug which pops up in edge cases only. My xml:
<TextView
android:id="@+id/input_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{inputValue}"
android:textColor="@{showAsEmpty ? @color/registerInputEmpty : @color/registerInputSet}"
tools:text="Select to edit"/>
The problem with it is the inputValue parameter, and the input_value id. They become the same inputValue field in data binding. This is only a problem if you set a custom color. An error from Google, should be fixded in the next update.