[Android] my custom svg icon is always black on Android
See original GitHub issueDescription
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appicon.svg" />
Using this simple svg as MauiIcon
on Android displays black shape on black background.
The colors cannot be modified by any MauiIcon property (as far as I have been trying exhaustivly for the last 4 hours)
The shape can be seen during a few frames when the application is started from the Android applications menu/list (there is an animation on Android which quickly shows the shape without backgorund -> black “alpha” shape is visible in these few frames)
Note: the file must be called appicon
for Android else the project fails to build.
The svg shape is rendered as black when used in MauiSplashScreen
as well.
https://docs.microsoft.com/en-us/dotnet/maui/user-interface/images/app-icons?tabs=android I read that svg files are converted to bitmaps. Is is an issue in the conversion then?
.NET MAUI converts SVG files to PNG files.
Is that really needed? The svg
size is 2 kB. PNG size is probably hundreds of kB. We use svg
s to squeeze application size. MAUI isn’t capable of displaying svg
s?
Steps to Reproduce
Try use the image as Android icon (maybe the black image occurs on Windows as well?)
Version with bug
Release Candidate 3 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top GitHub Comments
Hi, @janseris looks like the issue is when the SVG file contains CSS styles, I did a small test, and here are my findings:
SVG to reproduce the issue
Same SVG without CSS - Works !!
Tested with VS 2022 version 17.3.0 Preview 1.0
I believe that bug was fixed here: #7106 and is a duplicate of #7101
If this is still happening on the latest public preview, please reopen with a binlog.