Need help with SVG library

Aysic4Bandroid

Member
Licensed User
Longtime User
Hi,
(moved from libraries forum - srry!)

Im trying to use SVG images as backgrounds for views. The tutorial by AGraham the library author shows an example of doing this with a label. Replacing the label with a button in the example works ok except the svg will not fill the entire button.

Also, is it possible to have the same functionality as BitmapDrawable so i can specify the SVG image to display for different button states?

Any suggestions please?? - i don't know enough about SVG, so i'm struggling with this library.

thnX in advance:sign0085:
 

margret

Well-Known Member
Licensed User
Longtime User
I am not sure what you are doing as I have not messed with the SVG Lib. You might try something like this. Be sure to rename the bdn.png to the image you want to use.

B4X:
Dim vividm As Button
vividm.Gravity = Gravity.FILL
vividm.TextColor = Colors.Gray
vividm.SetBackgroundImage(LoadBitmap(File.DirAssets, "bdn.png"))
 
Upvote 0

Aysic4Bandroid

Member
Licensed User
Longtime User
hi,

thanks for the reply - but fraid thats not what i meant - i can do that already. Im using Scalable Vector Graphics SVG's which can resize by any % without distortion or pixelation. So in other words one image will suffice for any screen size/resolution. This cant be achieved with pngs, jpgs, gifs etc
 
Upvote 0

Aysic4Bandroid

Member
Licensed User
Longtime User
@Erel - StateListDrawable exactly what i meant - thanks. I am, however, still having problems getting SVGs that will load properly with this library - i get errors stating that 'at least two colours are expected' in the svg ?? Ive downloaded a free open source program called Inkscape which has an option to 'save as' optimized SVG which works 'sometimes' but still doesn't always produce an SVG which A.Grahams library can read.
 
Upvote 0
Top