title: android data binding colors from resources
body: <p>Is it possible to reference colors from xml using databinding for android?</p>
  
  <p>This works fine:</p>
  
  <pre><code>android:textColor="@{inputValue == null ? 0xFFFBC02D : 0xFFFFEB3B}"
  </code></pre>
  
  <p>but this does not:</p>
  
  <pre><code>android:textColor="@{inputValue == null ? @color/red : @color/blue}"
  </code></pre>
  
  <p>Reported it here: <a href="https://issuetracker.google.com/issues/38021292" rel="nofollow noreferrer">https://issuetracker.google.com/issues/38021292</a></p>
  
  <p><strong>* EDIT *</strong></p>
  
  <p>It turns out it was just and id issue / bug which pops up in edge cases only. My xml:</p>
  
  <pre><code>    &lt;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"/&gt;
  </code></pre>
  
  <p>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.</p>