2

I have some icons in SVG format. Converting it to VectorDrawables does not seem to be OK. It is sharp as it should be

Does any one has an idea what could be the reason?

Here is the original SVG icon: enter image description here

and here how it look like on Android as a VectorDrwable: enter image description here

Metwalli
  • 1,861
  • 1
  • 18
  • 27
  • 1
    `Here is the original SVG icon:` Hopefully, you know that an SVG **is different** from a VectorDrawable (which only uses a **subset** of the SVG directives) – Phantômaxx Aug 04 '16 at 12:51
  • True,but when I checked the paths for both SVG and VectorDrawable it was the same exactly so I have no clue why it is drawn differently – Metwalli Aug 04 '16 at 16:08
  • You should **convert** the original SVG to an Android proprietary VectorDrawable file. I'm sure that (at least) the headers are different. – Phantômaxx Aug 04 '16 at 16:10
  • Here is both of them : https://drive.google.com/file/d/0BwTqAXuWb_bCYWh2Z0cyNndqdkU/view?usp=sharing https://drive.google.com/file/d/0BwTqAXuWb_bCNUszUzFMSXJKRk0/view?usp=sharing Could please tell me what kind of headers should I change? – Metwalli Aug 11 '16 at 09:34
  • The first link is an **apk**, not an **svg** - how can I compare them? – Phantômaxx Aug 11 '16 at 09:36
  • SVG https://drive.google.com/open?id=0BwTqAXuWb_bCdHY1R3k5aVJtRkk Sorry about that – Metwalli Aug 11 '16 at 12:46
  • The only difference I'm able to spot out (at a rough glance) is that the fill color is different: SVG: `#acacac`, VectorDrawable: `#000000`. – Phantômaxx Aug 11 '16 at 12:57

1 Answers1

1

This question is quite old, and I hope you found a solution long ago, but this seems like svg behavior that I've experienced before. In my case, the issue was that the svg was using the wrong fill-rule.

The gist is that the svg spec includes two fill-rules; nonzero, and evenodd. Android only supports nonzero prior to API level 24. You can change the fill rule directly in the VectorDrawable, but you might need to make some edits to your svg so the paths are looping in the right direction.

For anyone who encounters this later, check out this article for a great explanation.

M.Pomeroy
  • 997
  • 11
  • 22