title: Can't apply a colorFilter to text selection handles
body: <p>I'm trying to bring material text selection handles to my app. I got drawables from the SDK for middle/right/left handle (bitmaps) and text cursor (9-patch), and set:</p>
  
  <pre><code>&lt;item name="android:textSelectHandleLeft"&gt;@drawable/text_select_handle_left_mtrl_alpha&lt;/item&gt;
  &lt;item name="android:textSelectHandleRight"&gt;@drawable/text_select_handle_right_mtrl_alpha&lt;/item&gt;
  &lt;item name="android:textSelectHandle"&gt;@drawable/text_select_handle_middle_mtrl_alpha&lt;/item&gt;
  &lt;item name="android:textCursorDrawable"&gt;@drawable/text_cursor_mtrl_alpha&lt;/item&gt;
  </code></pre>
  
  <p>It works as expected. However, in Lollipop these drawables are tinted with a particular color in XML using the <code>android:tint</code> attribute, which I can't use on API&lt;21. So I'm trying to set a color filter at runtime.</p>
  
  <p><img src="https://i.stack.imgur.com/Thyh6.gif" alt="enter image description here"></p>
  
  <ul>
  <li><p>Text cursor does not get tinted. I think this might be due to it being a 9 patch. How can a 9-patch drawable be filtered at runtime? I tried probably all of <code>PorterDuff.Mode</code>s.</p></li>
  <li><p>Right/left handles are black, while middle handle is white.</p></li>
  </ul>
  
  <p>I.e., non of them is green as I would like. Why?</p>
  
  <p>As you can see above, I set up four <code>ImageView</code> below my edit text, and they instead get tinted.</p>
  
  <pre><code>   private void setUpTextCursors() {
          Drawable left = getResources().getDrawable(R.drawable.text_select_handle_left_mtrl_alpha);
          Drawable right = getResources().getDrawable(R.drawable.text_select_handle_right_mtrl_alpha);
          Drawable middle = getResources().getDrawable(R.drawable.text_select_handle_middle_mtrl_alpha);
          Drawable cursor = getResources().getDrawable(R.drawable.text_cursor_mtrl_alpha);
          ColorFilter cf = new PorterDuffColorFilter(mGreenColor, PorterDuff.Mode.SRC_IN);
  
          /**
          * tint my ImageViews, but no effect on edit text handles
          */
          left.setColorFilter(cf); 
          right.setColorFilter(cf);
          middle.setColorFilter(cf);
  
          /**
          * no effect whatsoever
          */
          cursor.setColorFilter(cf);
     }
  </code></pre>
  
  <p>Looks like here we have both a 9-patch tinting issue - since filter fails even on test ImageViews - and an issue related to the fact that none of the applied filters get considered by the text selection manager.</p>
  
  <p>Relevant source code about that is from the <code>TextView</code> <a href="https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java" rel="noreferrer">class</a> and from this <code>Editor</code> hidden <a href="http://my.fit.edu/~vkepuska/ece5570/adt-bundle-windows-x86_64/sdk/sources/android-16/android/widget/Editor.java" rel="noreferrer">helper class</a> which I found somehow. Spent some time on it but still can't tell why my filters are ignored.</p>
  
  <hr>
  
  <p>To @pskink: let <code>cursor</code> be the filtered drawable, I can have:</p>
  
  <pre><code>&lt;ImageView
      android:id="@id/1"
      android:src="@drawable/cursor_drawable" /&gt;
  
  &lt;ImageView 
      android:id="@id/2" /&gt;
  </code></pre>
  
  <p>The first won't be tinted, but if I call <code>imageView2.setBackground(cursor)</code>, then it's tinted.
  Also if I have</p>
  
  <pre><code>&lt;item name="android:textSelectHandle"&gt;@drawable/cursor_drawable&lt;/item&gt;
  </code></pre>
  
  <p>this affects the edit selection (because I override the default cursor) but it's not tinted, again.</p>