Fixed
Status Update
Comments
st...@gmail.com <st...@gmail.com> #2
I agree, tinting the icons should be the default behaviour.
am...@google.com <am...@google.com> #3
Hi,
Request you to provide below information
Please attach your sample android project which reproduces the issue, zip it and share(just to avoid the confusion between your sample code and the one we create to replicate the issue,sample code is requested here).
Attach screen shots for expected and observed behavior for more clarity.
Explain the steps to reproduce the issue with your apk or provide screenrecord which demonstrates the issue. Provide all necessary information to reproduce the issue.
Screen Record of the Issue
Please capture screen record or video of the issue using following steps:
adb shell screenrecord /sdcard/video.mp4
Subsequently use following command to pull the recorded file:
adb pull /sdcard/video.mp4
Attach the file to this issue.
Note: Please upload the attachments to google drive and share the folder to android-bugreport@google.com, then share the link here.
Request you to provide below information
Please attach your sample android project which reproduces the issue, zip it and share(just to avoid the confusion between your sample code and the one we create to replicate the issue,sample code is requested here).
Attach screen shots for expected and observed behavior for more clarity.
Explain the steps to reproduce the issue with your apk or provide screenrecord which demonstrates the issue. Provide all necessary information to reproduce the issue.
Screen Record of the Issue
Please capture screen record or video of the issue using following steps:
adb shell screenrecord /sdcard/video.mp4
Subsequently use following command to pull the recorded file:
adb pull /sdcard/video.mp4
Attach the file to this issue.
Note: Please upload the attachments to google drive and share the folder to android-bugreport@google.com, then share the link here.
st...@gmail.com <st...@gmail.com> #4
I have made a sample project, and uploaded it to Google Drive: https://drive.google.com/drive/folders/0B5e8g70ifkb0b2VVQjNjM1V1OG8?usp=sharing
Attached is also a screenshot showing the issue. The text and overflow icon (three dots) are automatically tinted white. The icon for the menu item I provided is not tinted automatically.
Some more examples can be found in the stackoverflow links in the original post.
Attached is also a screenshot showing the issue. The text and overflow icon (three dots) are automatically tinted white. The icon for the menu item I provided is not tinted automatically.
Some more examples can be found in the stackoverflow links in the original post.
am...@google.com <am...@google.com> #5
Hi,
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
am...@google.com <am...@google.com> #6
Hi,
The development team has fixed the issue that you have reported and it will be available in a future support lib version.
Thanks
The development team has fixed the issue that you have reported and it will be available in a future support lib version.
Thanks
st...@gmail.com <st...@gmail.com> #7
Hi,
In what version of the Support Library was this fixed, or what do we have to do to get the icons tinted?
I have updated the sample app (attached) to the latest version of the support library (26.0.1), and the issue still occurs.
https://drive.google.com/file/d/0B5e8g70ifkb0TXp1QU4zZ1lEd0E/view?usp=drive_web (BugApplication2.zip)
In what version of the Support Library was this fixed, or what do we have to do to get the icons tinted?
I have updated the sample app (attached) to the latest version of the support library (26.0.1), and the issue still occurs.
ha...@gmail.com <ha...@gmail.com> #8
Same here, current support lib 27.0.1 does not tint custom icons :-(
zh...@gmail.com <zh...@gmail.com> #9
I'm also still seeing this issue in 27.1.0 and 27.1.1. Was it actually fixed? Any updated would be appreciated.
Thank you.
Thank you.
ca...@gmail.com <ca...@gmail.com> #10
I'd also like to see an update on this
ma...@gmail.com <ma...@gmail.com> #11
July 27th, 2018.
Tinting Icons in the latest stable support lib 27.x.x is not working.
Applying an `android:theme=` that inherits from Theme.AppCompat to a Support v7 Toolbar doesn’t work as expected.
Say you have:
styles.xml:
<!-- The main App Theme, doesn’t really matter… —>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
… etc (omitted for simplicity)
</style>
For your Toolbar you decide to simply do this:
<style name="ToolbarsAreViolet" parent="Theme.AppCompat.Light”>
<item name="android:tint">@color/green</item>
<item name="colorControlNormal">@color/violet</item>
</style>
some_menu.xml:
<menu
xmlns:android="http://schemas.android.com/apk/res/android "
xmlns:app="http://schemas.android.com/apk/res-auto ">
<item
android:id="@+id/some_action"
android:title="@string/some_string"
android:icon="@drawable/a_vector_graphic_not_from_appcompat"
app:showAsAction="always" />
</menu>
some_fragment.xml
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height=“wrap_content"
android:theme="@style/ToolbarsAreViolet"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark”/> //the popup theme changes nothing here
SomeFragment.java:
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.some_menu.xml);
Doesn’t produce the expected output.
The `tint` property, only affects the navigation icon ONLY IF IT’S custom (non AppCompat icon), which TintManager ignores(?). If the icon is part of AppCompat, then the icon will use controlColorNormal.
The `controlColorNormal` property, doesn’t tint your icon… and neither does tint.
The work around is to add (to your vector graphic):
Say you have this:
<vector
xmlns:android="http://schemas.android.com/apk/res/android "
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData=“xxxx" />
</vector>
You need to add:
android:tint="?attr/colorControlNormal"
so it looks like:
<vector
xmlns:android="http://schemas.android.com/apk/res/android "
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData=“xxxx" />
</vector>
and NOW the theme engine will pick it up…
EXPECTED:
That tinting a damn widget didn’t take eight hours, three hundred different experiments, 200 app launches, until you end up copying and pasting from seven different hacks.
WHAT HAPPENED:
The Android Theme/Styles engine is a disaster. The discoverability is Log(n) but negative.
Tinting Icons in the latest stable support lib 27.x.x is not working.
Applying an `android:theme=` that inherits from Theme.AppCompat to a Support v7 Toolbar doesn’t work as expected.
Say you have:
styles.xml:
<!-- The main App Theme, doesn’t really matter… —>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
… etc (omitted for simplicity)
</style>
For your Toolbar you decide to simply do this:
<style name="ToolbarsAreViolet" parent="Theme.AppCompat.Light”>
<item name="android:tint">@color/green</item>
<item name="colorControlNormal">@color/violet</item>
</style>
some_menu.xml:
<menu
xmlns:android="
xmlns:app="
<item
android:id="@+id/some_action"
android:title="@string/some_string"
android:icon="@drawable/a_vector_graphic_not_from_appcompat"
app:showAsAction="always" />
</menu>
some_fragment.xml
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height=“wrap_content"
android:theme="@style/ToolbarsAreViolet"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark”/> //the popup theme changes nothing here
SomeFragment.java:
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.some_menu.xml);
Doesn’t produce the expected output.
The `tint` property, only affects the navigation icon ONLY IF IT’S custom (non AppCompat icon), which TintManager ignores(?). If the icon is part of AppCompat, then the icon will use controlColorNormal.
The `controlColorNormal` property, doesn’t tint your icon… and neither does tint.
The work around is to add (to your vector graphic):
Say you have this:
<vector
xmlns:android="
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData=“xxxx" />
</vector>
You need to add:
android:tint="?attr/colorControlNormal"
so it looks like:
<vector
xmlns:android="
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData=“xxxx" />
</vector>
and NOW the theme engine will pick it up…
EXPECTED:
That tinting a damn widget didn’t take eight hours, three hundred different experiments, 200 app launches, until you end up copying and pasting from seven different hacks.
WHAT HAPPENED:
The Android Theme/Styles engine is a disaster. The discoverability is Log(n) but negative.
pe...@gmail.com <pe...@gmail.com> #12
2023 and this is still an issue! Thanks to the last comment to help me fix this issue
Description
Theme used: Theme.AppCompat (but any AppCompat theme works)
Devices/Android versions reproduced on: All
What happens:
When inflating a menu resource that contains menu items with icons that are black (or white) opaque drawables, they are not tinted appropriately. However, the up icon and overflow icon ARE appropriately tinted.
What I expect to happen:
The icons should be tinted (matching the up and overflow icons).
What appears to be going on:
It appears that there is a whitelist of "tintable" icons in appcompat, and only these icons are tinted automatically.
Personally, I would consider this a bug, but I'm guessing it might be "working as intended". If that's the case, then please consider this a feature request. Here's what I would like to happen:
When specifying icons in a menu resource for use in the action bar, they should automatically be tinted based on the theme (including disabled state).
Although I think this is increasingly unlikely today (since most people are probably providing tintable drawables for action bar icons), you could provide a way to specify a custom color/ColorStateList for a particular menu item using something like app:tint="@color/menuItemTint", or app:tint="@null" if you just don't want it to tint a particular icon.
I understand that this would be changing the default behavior, but I think this would be a very welcome change by most developers.
Here are some related SO links: