title: Android SetColorFilter() vs. SetBackgroundResource() / SetColorBackground()
body: <p>Can anyone explain this difference in appearance?<br>
  SetColorFilter() acts on the background Drawable, whether setBackgroundResource() sets the background color.<br>
  In Android version 2.3 I safely used SetColorFilter() to alter the background color of EditText, since it is very easy to restore the original color by clearing the filter. No need to get and remember it. Now there seems to be a difference between the two ways.</p>
  
  <p>This is an EditTextPreference dialog box, et is the EditText id.</p>
  
  <pre><code>        public void afterTextChanged(Editable s) {
              String source = s.toString();
              et.removeTextChangedListener(this);
              if( !source.matches("^[0-9]+$") ) {
                  et.getBackground().setColorFilter(getResources().getColor(R.color.invalid), Mode.OVERLAY);
                  et.invalidate();
                  et.selectAll();
              } else {
                  et.getBackground().clearColorFilter();
                  et.invalidate();
              }
              et.addTextChangedListener(this);
          }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/iDXAf.png" alt="enter image description here"></p>
  
  <p>And this is the same code using SetBackgroundResource()</p>
  
  <pre><code>        public void afterTextChanged(Editable s) {
              String source = s.toString();
              et.removeTextChangedListener(this);
              if( !source.matches("^[0-9]+$") ) {
                  et.setBackgroundResource(R.color.invalid);
                  et.selectAll();
              } else {
                  et.setBackgroundResource(R.color.valid);
              }
              et.addTextChangedListener(this);
          }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/PGOMS.png" alt="enter image description here"></p>