Most epic Android Support Design bug? I have ever seen

62 Views Asked by At

I found an interesting bug with image tint on Android >6.0.1. I use color filter to tint selected and unselected tab icon. Like

private int[] tabIcons = {
        R.drawable.white_calendar,
        R.drawable.white_magazine,
        R.drawable.white_pulse,
        R.drawable.white_error,
        R.drawable.white_user
};

public MainTabUtils setTabIcons() {
    for (int i = 0; i < tabLayout.getTabCount(); i++) {
        if (tabLayout.getTabAt(i) != null) {
            tabLayout.getTabAt(i).setIcon(tabIcons[i]);
            tabLayout.getTabAt(i).getIcon().setColorFilter(Color.parseColor("#00B0B0"), PorterDuff.Mode.SRC_IN);
        }
    }
    tabLayout.getTabAt(0).getIcon().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
    setActivityTitle(0);
    return this;
}

But if I use same drawable resource even with tint in xml it's become same color as tab icon. Even in another activity/fragment. On Android <6 all ok.

Used:

compile 'com.android.support:design:25.0.1'

Is it bug or I do something wrong?

0

There are 0 best solutions below