question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linear Gradients not working? [SVG]

See original GitHub issue

Hi, I am attempting linear gradients, but they do not work. Here is how it is done in the code:

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="512" width="512">

	<defs>
		<linearGradient id="LinearGradient" x1="0" x2="0" y1="0" y2="1">
			<stop offset="0%" stop-color="#ff0000"/>
			<stop offset="50%" stop-color="#ffffff"/>
			<stop offset="100%" stop-color="#0000ff"/>
		</linearGradient>
				<linearGradient id="LinearGradient2" x1="0" x2="0" y1="0" y2="1">
			<stop offset="0%" stop-color="#ff0000"/>
			<stop offset="100%" stop-color="#ffffff"/>
		</linearGradient>
				<linearGradient id="LinearGradient3">
			<stop offset="0%" stop-color="#ff0000"/>
			<stop offset="100%" stop-color="#0000ff"/>
					</linearGradient>
	</defs>
	<filter id="blurMe">
		<feGaussianBlur in="SourceGraphic" stdDeviation="5" />
	</filter>
	
	<circle id="templateCircle" cx="128" cy="128" r="128" fill="url(#LinearGradient)" visibility="visible" />
	<circle id="templateCircle2" cx="128" cy="384" r="128" fill="url(#LinearGradient2)" visibility="visible" />
	<circle id="templateCircle3" cx="384" cy="128" r="128" fill="url(#LinearGradient3)" visibility="visible" />
	<circle id="templateCircle4" cx="384" cy="384" r="64" fill="#ff0000" filter="url(#blurMe)" visibility="visible" />
</svg> 

And here is a link to the SVG online: http://quakeulf.suxos.org/bilder/bearbeidet/variabelen/SVG/test7.svg

But when running this on an Android phone all we get are single-coloured shapes and no gradients.

What are we doing wrong? Please help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
daniel-luberdacommented, Jul 30, 2017

I strongly advice you to use this: https://jakearchibald.github.io/svgomg/ (it can really solve a lot of svg files loading issues).

It’s even mentioned on our SVG Wiki page.

0reactions
RamyaBRcommented, Oct 28, 2022

This issue still exist in the Xamarin Forms 2.4.11.982

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG gradient not working
I've a svg and I need to fill it with a gradient, the css is added by a script, if U work with...
Read more >
Issues with gradients going from .AI to .SVG
Hi. SVG is not the best format for export images with gradients. I suggest you use another format like jpg or png.
Read more >
751733 - Linear gradients in SVG sprites are not displayed
Steps to reproduce the problem: 1. Take an SVG with a gradient defined inside of it. (attached: store_badge_android.svg) 2. Put it in a...
Read more >
Gradients in SVG - SVG: Scalable Vector Graphics | MDN
There are two types of SVG gradients: linear and radial. They are defined separately from where they are used, which promotes reusability.
Read more >
LinearGradients in SVG's not rendering correctly
When I save an svg from Adobe Illustrator, the x1, x2, y1, y2 and the stop offset values of any linearGradients are set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found