Are there any Android Drawable designers? - android

I would like to use more vector drawings in my Android applications. Providing images isn't as space efficient or as scalable as I would like it to be.
Android provides a series of Drawable file formats, such as ShapeDrawable, which can be combined in a LayeredDrawable. To go very far down this path, it would be nice if there was a designer for visualizing the results, doing the drawing in, and handling all the resulting files.
C# WPF has Expression Blend, Adobe has Flash CS4, and the iPhone has Opacity. So my question is, is there a designer or drawing tool for Android?
Note: Other questions have talked about using SVG in Android. Android doesn't have native support for SVG, so the only way to do it is with an external library. I would like to avoid that and am asking for a developer side tool. An SVG to Drawable converter would be fine, but I'm not aware of one.

I faced the same problem and I've just released a little library on github that allow to export svg to drawable more quickly.
https://github.com/r3gis3r/svg2drawable
Hope can be useful for you.

For the sub-subset of rectangular ShapeDrawables there is a nice tool online at Angry Tools which allows one to edit a button's drawable:
http://angrytools.com/android/button/

I would suggest you using Vector Drawables, which are natively supported by Android 5.0+. There is an SVG to VectorDrawable Converter, so you can create SVG images in your favorite editor.
BetterVectorDrawable is the VectorDrawable implementation for Android 4.0+ with configurable fall-back behavior on Android 5.0+.
SVG to VectorDrawable Converter is the batch converter of SVG images to Android VectorDrawable XML resource files. Online version exists.
Links point to readmes, which provide enough information on how to use the lib and the converter.

Yes, there is.
https://play.google.com/store/apps/details?id=com.tiraisoft.drawabledesigner
It runs on Android so you can see the changes live.
Disclaimer:
I'm the author

Related

What is the Android vector drawable specification

Im attempting to replace all my Android drawable png assets with VectorDrawables.
Where I use the Android Studio standard assets obviously everything is fine.
Some externally imported SVG assets fail as Android does not support the industry-standard SVG specification.
Does an Android vector drawable specification exist?
which lists all acceptable SVG commands that Android (Android Studio) will accept?
As far as I am aware, there is no formal written specification for the VectorDrawable format other than the VectorDrawable class definition in the documentation.
https://developer.android.com/reference/android/graphics/drawable/VectorDrawable
There is also quite a lot of extra information on this page:
https://developer.android.com/studio/write/vector-asset-studio
Neither of these have a list of SVG elements that are supported by the importer. However you can look at the code for the importer in the Android source code for the definitive answer as to what is supported. The source code is here: SVG2Vector.java
From the code, you can see that the supported SVG elements are limited to:
<polygon>, <rect>, <circle>, <line>, <path>, <g>
Note that these are only partially supported, as only a limited set of their attributes are handled. Basically just the stroke and fill related ones, plus transform and display:none.
There are, however, other third-party converters available that claim to do a better job. Although what they can possibly support is limited by what VectorDrawable itself supports.

Can I use SVGs instead of PNGs to large scale project

We've already built projects like DocuSign in both iOS and Android, we've quite extensive use of documents which is loaded in form of PNGs, where users can quickly move to their selected page (e.g 1 -> 25), so we worked on closely to make it stable and fast but we've requirement to not gets pixelated while zooming (where PNG lack and gets pixelated), so I done R&D on vector base supported in iOS and found that PDF will not fit for our requirement but SVG may fit. But As SVGs aren't natively supported in iOS so
Is it the right decision to use any third party for SVG support in iOS
like https://github.com/SVGKit/SVGKit in large scale projects?
Will memory management will effect I read many links where it
mentioned it's not recommended like
https://www.quora.com/Should-you-use-SVG-files-for-images-in-an-iOS-app
?
Does anybody go through this kind of problem? looking for suggestions and solutions.
NOTE: These images are coming from cloud(our server, google drive, dropbox and One drive)
You can use Vector xml
Right click on rec>drawable folder
select Vector Asset
then select Local file(SVG)
Pick path of svg file
and import this will convert your SVG to the vector xml file, this vector drawable you can use in place of PNG files

Android Studio Vector asset always could not generate a preview

I want to use vector asset in android studio to generate svg xml file,
I convert my png to svg in this web site
but when I use this svg file in vector asset to generate xml file, I get following error message
It display "could not generate a preview"
How can I fix it?
Most of the complaints on this topic are due to people trying to convert SVGs that use features of the SVG standard that are not supported by VectorDrawables. And the SVG to VectorDrawable converter in AndroidStudio only supports those limited features. It doesn't really give much feedback when it encounters things it doesn't support.
Some of the online converters try a bit harder. You might have better success with them.
Otherwise you may have to simplify your SVGs to get them to work.
If you need to display SVGs images that are more complicated than VectorDrawables can handle, then you can always consider using an SVG rendering library for Android. IMHO the best one is AndroidSVG (disclaimer I wrote that one).
There are some cases when your actual .svg file name contains some capital letters. Just rename them in all small letters and try to upload it.
For instance:
If actual .svg image name is mySavedimage.svg {here 'S' is capital which is against norms of android assets}. SO if you rename that file to my_saved_image.svg then this will work as a charm.
hope it helps.
I've never had any luck with those convert sites. You're better off using photo tools to create an SVG. Make sure to follow the SVG guidelines from Android listed here
The error is in the converter. The SVG file might not be proper.
You need to use photo editor tools like Photoshop or Gimp.

Displaying SVG files in Android

I want to create an app that will display position on some floor plan. Navigation is implementing via WiFi in certain way, I've done it and so now I have a problem of displaying floor plan.
It might be in some vector format, after surfing internet for some time I've decided that it must be svg file.
I found some solutions, but it isn't working for me!
Library svg-android
There is opportunity to display .svg files, but only "simple" files. It works fine only for file in tutorial, but not for any other .svg file (for example, some other file, that you'll create with Inkscape).
So, I decided, that I'll parse .svg file, make DOM from it, somehow get objects and attributes and draw it via OpenGL ES.
Apache Batik
At first glance, very good solution, but there is a problem. Android has some "native" apache libraries and when I try to do something with batik, it throws NoClassDefFoundError, because it's searching not in batik libraries, but in "native" libraries.
Of course, we can add source code in our project, take only batik parser for .svg files and edit it in some way, but there is a lot of work, with same success we can write our own parser.
Tiny Line
There is no trial version, but if we'll see description of how it works for svg files and android, we'll see that there is only rasterization of such files and that's all.
Is there any solution better than writing own parser?
Did anyone come across this problem?
I would suggest using #1. Don't write your own parser. It's just going to be a huge headache.
How detailed does your floor plan have to be? android-svg supports SVG fairly well. It just doesn't have great support for filters or light sources. Your SVG isn't going to have those in them (I hope).
If you don't want to do that, look into quad trees. You can render out a huge image and break that down into a quadtree like format then only load the quads you require.
I have authored an SVG libaray for android the website is
http://www.vectoroid.com
the main thing missing is SVG arc support this is currently fixed and will be in a release in the near future.
I am looking for feedback on it, as i have been working on it for about a year. So if you have any please do tell ...
I've using yet another SVG for Android; seems it is relatively new.
GPLv3, CSS2 support, fonts, texts and spans, linear and radial gradients, SVG and SVGZ, initial filtering support, images from assets, from web and inline base64-encoded images. Fastest from all I've tried.
Of course filters support might be better, but except this it works well and even displays 20-megabytes SVG files.
Successfully tested these 2 libraries:
https://github.com/BigBadaboom/androidsvg - Apache License 2.0
https://scand.com/products/svgkit-android/ - needed tweaking to compile with modern SDK (suppress warnings, update gradle file); LGPL / commercial
androidsvg looks better so far.

Does android have *native* support SVG image as drawable resources (icons)?

I'm reading and watching UI tutorial. They all talk about the fact that you need to be aware of different devices size and resolution. Therefore export your icons into several size to support different screen density.
SVG is an open standard (W3C) that should be use to tackle this kind of problem. So can I natively use SVG file as drawable for my icons ?
N.B.: I'm NOT talking about browser support.
Android does not support SVG rasterization. Look at libsvg-android or svg4mobile. It solves that problem.
The answer has changed. Since version 21, Lollipop the operating system has had support for VectorDrawable. This is added to by a support library that allows you to use VectorDrawable well back into previous versions. These include support for importing most of the important SVG vector commands and having Android Studio automatically convert them to a VectorDrawable.
Use Vector Image Assets for all versions. -- Also even in older versions it's entirely possible to do fonts. Basically you give it a font asset then load up a specific letter of the font as an icon. Since fonts are glyphs and vector glyphs at that, you can very much get vector icons pretty far back.
https://fortawesome.github.io/Font-Awesome/icons/

Categories

Resources