How to tint a Button's drawable using appcompat 23.3.0?
<p>I am facing several issues with the new AppCompat 23.3.x and drawables. First of all, I had to go back and remove:</p>

<pre><code>vectorDrawables.useSupportLibrary = true
</code></pre>

<p>Because the AppCompat reverted that so now, my app is generating PNG again. Ok, however, I was tinting a button (the drawableTop) in a way that stopped working completely (for devices previous to M).</p>

<p>Here is the method I was using:</p>

<pre><code>private void toggleState(boolean checked) {
    Drawable[] drawables = getCompoundDrawables();
    Drawable wrapDrawable = DrawableCompat.wrap(drawables[1]);
    if (checked) {
        DrawableCompat.setTint(wrapDrawable.mutate(), ContextCompat.getColor(getContext(),
                R.color.colorPrimary));
        setTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
    } else {
        DrawableCompat.setTint(wrapDrawable.mutate(), ContextCompat.getColor(getContext(),
                R.color.icon_light_enabled));
        setTextColor(ContextCompat.getColor(getContext(), R.color.text_primary_light));
    }
}
</code></pre>

<p>The thing is, I have a custom Button class that is checkable, if checked, drawableTop and text have a different color that if it's not checked.</p>

<p>Doing this was working (with appcompat 23.2.0), but now, it is not (below Android M). Believe me or not, but doing this, when it hits <code>setTint</code> the icon is not visible anymore at all.</p>

<p>To make it work, I have to do like follows:</p>

<pre><code> DrawableCompat.setTint(wrapDrawable.mutate(), ContextCompat.getColor(getContext(),R.color.colorPrimary));
 setCompoundDrawablesWithIntrinsicBounds(null, wrapDrawable, null, null);
</code></pre>

<p>So everytime I tint them, I have to call <code>setCompoundDrawablesWithIntrinsicBounds</code> again. Doing so makes everything to work again. However, I am a bit concerned about the performance of setting the drawable everytime. Basically, I wonder if there is a better way or something I am missing.</p>

<p>I know a <code>Button</code> has <code>setCompoundDrawableTintList</code> which would be marvelous but its minimum API is level 23.</p>