Loading SVGs in AppInventor?

I found a weather icon set on Github with animated SVGs I'd like to use, however the picture elements don't load a URL to an SVG.
image

Is it possible to load an SVG into an image? I hate to use a webview because the background will not be transparent. I would also like to avoid downloading, converting, and uploading all of the SVGs to PNGs and to the app. (source)

I found an SVG loading extension on Kodular, but it requires a logged in user to download and I have never been able to sign up with them.

Seems both svg extensions are on Kodular...

Can you try a webviewer ? Would that work ?

And the Kodular signup process either fails or I never receive the confirmation email.

With the webviewextra extension you can set the webviewer background transparent (plus many other good reasons to use it :wink: )

Is this correct? The webviewer is just an empty white page.

You can embed an SVG image in an HTML file in several ways:

  • Using an iframe element
  • Using an img element
  • Using the SVG image as background image.
  • Using an svg element
  • Using an embed element

ref

1 Like

Interesting. I made this page that loads an SVG into a <img>.

On the companion, i see nothing but a blank white webview.
If I build the app, the animation shows but it looks very laggy. Not to mention the webview is not transparent.

I will do some testing, but will have to be later on...

1 Like

Turns out it was the webview size haha... Made it smaller and it is now smooth as butter.
The companion also renders the animation now as well (no idea what happened there).

However, it is still not transparent (I'll leave you to take a look at that :slight_smile:)

Oh..
image

One moment :person_facepalming:

Yep that was it! Transparent background works. Thanks for the help.

However, it would be nice to disable scrolling and zooming.

It is odd that one, sometimes it works, other times it doesn't

This seems to work for me:

image

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<head>
<title>SVG</title>
<style>
</style>
</head>

<body>
	<img src="isolated-thunderstorms-night.svg"/>
</body>

</html>

I'm looking to use a web svg, I don't want to download and upload so many images.

After modifying the Github Page a little, using a webview with your extension creates a decent design:

1 Like