A Aysic4Bandroid Member Licensed User Longtime User Jul 3, 2012 #1 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:
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 Jul 3, 2012 #2 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. Code: Copy Dim vividm As Button vividm.Gravity = Gravity.FILL vividm.TextColor = Colors.Gray vividm.SetBackgroundImage(LoadBitmap(File.DirAssets, "bdn.png")) Upvote 0
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. Code: Copy Dim vividm As Button vividm.Gravity = Gravity.FILL vividm.TextColor = Colors.Gray vividm.SetBackgroundImage(LoadBitmap(File.DirAssets, "bdn.png"))
A Aysic4Bandroid Member Licensed User Longtime User Jul 3, 2012 #3 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
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
Erel B4X founder Staff member Licensed User Longtime User Jul 4, 2012 #4 Search for StateListDrawable to use different drawables for the button state. Upvote 0
A Aysic4Bandroid Member Licensed User Longtime User Jul 4, 2012 #5 @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
@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.
Erel B4X founder Staff member Licensed User Longtime User Jul 4, 2012 #6 Sorry I'm not really familiar with SVG. Upvote 0