WAI
Status Update
Comments
tn...@google.com <tn...@google.com>
zt...@google.com <zt...@google.com> #2
So I guess what you want is android:tint, which apply to the whole drawable, right ?
That could be added in the next version.
On the other hand, modify each path's color (fill/ stroke) will need a more sophisticated vector editor.
That could be added in the next version.
On the other hand, modify each path's color (fill/ stroke) will need a more sophisticated vector editor.
db...@gmail.com <db...@gmail.com> #3
Can android:tint be taken into account when generating drawables for lower android versions? Currently changing the fill/stroke color or using android:tint doesn't seem to affect the generated color. I only get black icons.
zt...@google.com <zt...@google.com> #4
android:tint is currently not supported for lower android version, note that we need to support all the tintMode at the same time.
android:fill/Stroke color is supported for lower android version. Please file bugs against me if that didn't work for you.
android:fill/Stroke color is supported for lower android version. Please file bugs against me if that didn't work for you.
ke...@gmail.com <ke...@gmail.com> #5
He isn't talking about android:tint. When creating a Vector Asset you can choose a Material Design icon. The only problem is, is that they're all black. I'm working with a dark theme, so if I could press white in the Vector Asset Studio and when it creates the Vector Asset the android:fillColor is set to white instead of black. This can of course also be done with different colors.
ea...@google.com <ea...@google.com> #6
the recommend way to change colors of the vector drawable in a backwards compatible way is to use the android:tint tag in your layout.
ma...@gmail.com <ma...@gmail.com> #7
As far as I know, android:tint tag cannot be applied to menu xml files. Even if it was applicable, you cannot dynamically add/remove the android:tint tag based on dark/light theme.
What I do is that I create a dark theme which references white versions of images, and a light theme which references black versions, stored in a separate file. White vector versions could be named ic_filter_list_white_24.xml, it will have android:tint attached and could render to a white raster files (with no tint information whatsoever); on the other hand, black vector versions could be named ic_filter_list_black_24.xml, with no tint attribute.
Using this approach, the only thing that the Android Gradle Plugin needs to do is to honor the android:tint attribute when generating the bitmap versions. Exactly what #3 suggested.
What I do is that I create a dark theme which references white versions of images, and a light theme which references black versions, stored in a separate file. White vector versions could be named ic_filter_list_white_24.xml, it will have android:tint attached and could render to a white raster files (with no tint information whatsoever); on the other hand, black vector versions could be named ic_filter_list_black_24.xml, with no tint attribute.
Using this approach, the only thing that the Android Gradle Plugin needs to do is to honor the android:tint attribute when generating the bitmap versions. Exactly what #3 suggested.
ma...@gmail.com <ma...@gmail.com> #8
Changing the android:fillColor="#FFFFFFFF" worked for me, produced images are indeed white, thank you.
zt...@google.com <zt...@google.com> #9
To summarize:
Changing android:fillColor (and / or strokeColor) is the way to manually update the color.
Sorry, there is no automatic way yet, I just feel like it is not that a priority since a search / replace can do the trick after the import, if there are a lot of files involved. In that case, search / replace will be faster than open up a color picker. :)
Using android:tint at the parent view will be another viable approach, as long as the tint is setup correctly to replace the color inside the drawable.
Note that android:tint inside the drawable will be something not always work, b/c this is the tinting applied when drawing the drawable to the screen, not when creating the drawable. It really depends on your drawable's transparency and tintMode to behave differently.
Changing android:fillColor (and / or strokeColor) is the way to manually update the color.
Sorry, there is no automatic way yet, I just feel like it is not that a priority since a search / replace can do the trick after the import, if there are a lot of files involved. In that case, search / replace will be faster than open up a color picker. :)
Using android:tint at the parent view will be another viable approach, as long as the tint is setup correctly to replace the color inside the drawable.
Note that android:tint inside the drawable will be something not always work, b/c this is the tinting applied when drawing the drawable to the screen, not when creating the drawable. It really depends on your drawable's transparency and tintMode to behave differently.
ko...@gmail.com <ko...@gmail.com> #10
Strange observations.
android:fillColor="#FFFFFF" works
but
android:fillColor="@color/light_icons" don't work (light_icons is set to #FFFFFF)
is this deliberate? i'd think that using reference is convenient to update all vetors at once.
android:fillColor="#FFFFFF" works
but
android:fillColor="@color/light_icons" don't work (light_icons is set to #FFFFFF)
is this deliberate? i'd think that using reference is convenient to update all vetors at once.
zt...@google.com <zt...@google.com> #11
Hi kohangel,
Sorry for the confusion.
That is the limitation of the tool.
android:fillColor="@color/light_icons" will work for API 21, if you run your apps on the device, or set the Android Studio's preview window's API level >=21.
But it won't work for our backward support (XML -> PNG) path in order to support API < 21.
I hope this make sense.
Sorry for the confusion.
That is the limitation of the tool.
android:fillColor="@color/light_icons" will work for API 21, if you run your apps on the device, or set the Android Studio's preview window's API level >=21.
But it won't work for our backward support (XML -> PNG) path in order to support API < 21.
I hope this make sense.
ms...@gmail.com <ms...@gmail.com> #12
It would be appreciated if you added support for color references
bo...@gmail.com <bo...@gmail.com> #13
Hi same problem as kohan...@gmail.com. Voting for references. Otherwise it will make code more obfuscated.
I was happily changing all bitmaps to vectors and right in the middle this. I understand that it is limitation...
1) How can I use SVG with backward compatibility? (one graphical source, one color definition - reference) Based on what #c13 wrote - never?
2) If there is and will be no way, I should probably stay with bitmap. Or why would I want to switch to SVG anyway?
Thank you
I was happily changing all bitmaps to vectors and right in the middle this. I understand that it is limitation...
1) How can I use SVG with backward compatibility? (one graphical source, one color definition - reference) Based on what #c13 wrote - never?
2) If there is and will be no way, I should probably stay with bitmap. Or why would I want to switch to SVG anyway?
Thank you
zt...@google.com <zt...@google.com> #14
The key benefit of VectorDrawable is a smaller APK.
Having static color in the VectorDrawble and tune the tinting in the view / layout is a good solution for the original post.
For the #15 comment, there is another very related bug we are looking at external reference like @color/, @integer etc.https://code.google.com/p/android/issues/detail?id=194972
We will try to see if we could provide a good solution here.
Note that being able to reference all the resources also mean some performance cost.
Having static color in the VectorDrawble and tune the tinting in the view / layout is a good solution for the original post.
For the #15 comment, there is another very related bug we are looking at external reference like @color/, @integer etc.
We will try to see if we could provide a good solution here.
Note that being able to reference all the resources also mean some performance cost.
ma...@gmail.com <ma...@gmail.com> #15
Actually, the APK will be larger because the plugin will generate ldpi, mdpi, hdpi, xdpi, xxdpi bitmap versions of the svg file, for backward compatibility reason.
zt...@google.com <zt...@google.com> #16
Please utilize the multi apk support to separate an apk for lollipop above.
Or just build 2 apk with 2 mininal sdk version.
Or just build 2 apk with 2 mininal sdk version.
bo...@gmail.com <bo...@gmail.com> #17
For #16 - ad "Note that being able to reference all the resources also mean some performance cost."
- Do you mean cost of building time (rewriting all settings references in vector element to proper values, probably not that systemic, but functional solution) or more burden on device, while using Vector graphics in API level >=21?
- Do you mean cost of building time (rewriting all settings references in vector element to proper values, probably not that systemic, but functional solution) or more burden on device, while using Vector graphics in API level >=21?
ab...@gmail.com <ab...@gmail.com> #18
This happens when I run Android studio on pixelbook and tries to change the background color FFFFF to something else. Usually it should open the color picker but it crashes instead, It wouldn't allow to change the value with text either, as any click in the field is trying to open the color picker
A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007c5538785c69, pid=286, tid=0x00007c54ecada700
#
# JRE version: OpenJDK Runtime Environment (8.0_202) (build 1.8.0_202-release-1483-b49-5587405)
# Java VM: OpenJDK 64-Bit Server VM (25.202-b49-5587405 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libawt_xawt.so+0x46c69] ReadRegionsInList.constprop.5+0x3d9
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/abba4u/java_error_in_STUDIO_286.log
#
# If you would like to submit a bug report, please visit:
#http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007c5538785c69, pid=286, tid=0x00007c54ecada700
#
# JRE version: OpenJDK Runtime Environment (8.0_202) (build 1.8.0_202-release-1483-b49-5587405)
# Java VM: OpenJDK 64-Bit Server VM (25.202-b49-5587405 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libawt_xawt.so+0x46c69] ReadRegionsInList.constprop.5+0x3d9
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/abba4u/java_error_in_STUDIO_286.log
#
# If you would like to submit a bug report, please visit:
#
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Description
supply all required information.
It would be nice to specify a new icon's color directly in Vector Asset Studio, rather than having to edit the color directly in the generated drawable's XML.