Questions tagged [android-vectordrawable]

A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information.

VectorDrawable was introduced in Android 5.0 (Lollipop), it has now been included in the Android Support Library to work with earlier versions. The format can also be animated using the AnimatedVectorDrawable class.

VectorDrawable Official Documentation

AnimatedVectorDrawable Official Documentation

Information about inclusion in the Support Library

711 questions
216
votes
18 answers

Change fill color on vector asset in Android Studio

Android Studio now supports vector assets on 21+ and will generate pngs for lower versions at compile time. I have a vector asset (from the Material Icons) that I want to change the fill color. This works on 21+, but the generated pngs do not…
165
votes
13 answers

Getting Bitmap from vector drawable

In my application, I have to set a large icon for a notification. LargeIcon must be a Bitmap, and my drawables are vector images (the new feature in Android, see this link) The problem is when I try to decode a resource that is a vector image, I get…
liltof
  • 2,153
  • 2
  • 14
  • 23
131
votes
17 answers

Is it possible to use VectorDrawable in Buttons and TextViews using android:DrawableRight?

When I use VectorDrawable assets in a textview or imageview I get a runtime crash when using "android:DrawableRight" / "android:DrawableEnd" / "android:DrawableStart" / "android:DrawableLeft". The app will compile fine without any warnings. I am…
121
votes
4 answers

How to center vector drawable in layer-list without scaling

I am attempting to use a VectorDrawable in a LayerList without scaling the vector. For example:
ashughes
  • 7,155
  • 9
  • 48
  • 54
110
votes
2 answers

Convert VectorDrawable to SVG

I have made the opposite conversions (SVG to VectorDrawable) manually or using web tools. But I am having hard time to do the opposite thing. I have VectorDrawable but I am not sure how to convert it to SVG and I can find zero online tools to do…
sandalone
  • 41,141
  • 63
  • 222
  • 338
88
votes
9 answers

VectorDrawable - is it available somehow for pre-Lollipop versions of Android?

Background I've noticed that Android now supports some kind of vector drawing, via a class called "VectorDrawable" (and also AnimatedVectorDrawable, BTW). I've found about it by looking at what's new on Android-Studio. I wonder if this would be the…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
86
votes
4 answers

What is the impact of viewportwidth/height on Android drawables

I have an vector drawable I imported from an SVG asset. Sometimes, I have to adjust the size. Usually I update width and height. What I can't work out is how viewportwidth and height also impact the svg. It seems changing these dimensions can push…
angryITguy
  • 9,332
  • 8
  • 54
  • 82
77
votes
13 answers

How to use VectorDrawables in Android API lower than 21?

I am working on an Android project and I chose to display icon because it is adaptable and dynamically, however, I just can run this app on devices running Android, which have API 21 or higher. My question is how can I use on lower…
iamatsundere181
  • 1,401
  • 1
  • 16
  • 38
74
votes
14 answers

Support library VectorDrawable Resources$NotFoundException

I am using Design Support Library version 23.4.0. I have enabled the gradle flag: defaultConfig { vectorDrawables.useSupportLibrary = true } I am using build tools version 23.0.2, but still, I am getting Resources$NotFoundException on KitKat or…
71
votes
8 answers

How to set VectorDrawable as an image for ImageView programmatically

I want to set some vectorDrawables to a ImageView in Android Studio. I can set png and jpg drawable easily but when i want to set VectorDrawable, it does not work on imageview. img.setImageResource(R.drawable.ic_home); ic_home is VectorDrawable and…
Hamid Waezi
  • 878
  • 1
  • 7
  • 14
71
votes
6 answers

Android Selector Drawable with VectorDrawables srcCompat

I'm facing a problem with the new backward compatibility with VectorDrawables. In the Support Library 23.2 was a new feature for backward compatibility with Android VectorDrawables indroduced. I have an ImageView which is a SelectorDrawable…
68
votes
9 answers

How to create vector drawables for android?

I am new to VectorDrawables. I can see that the default vector drawables provided with android studio like ic_menu_gallery, ic_menu_camera, etc. are working great. So I tried to create my own vector drawables by converting my png images to svg…
theUturn
  • 1,101
  • 2
  • 12
  • 25
59
votes
5 answers

Converting SVG file to Android Vector Drawable XML while keeping the group structure in place

I want to convert SVG files to Android Vector Drawable XMLs. I need the structure of the SVG. To the extend that the SVG groups multiple elements together, I need that grouping to also be reflected in the Android Vector Drawable. Unfortunately, the…
Christian
  • 25,249
  • 40
  • 134
  • 225
56
votes
8 answers

Change fillColor of a vector in android programmatically

I want to edit the fill Color of a vector-file in Android programmatically. In the xml-file I can set my color with the attribute android:fillColor but I want to change the color in runtime. Any examples for that? Thanks.
Sascha K.
  • 623
  • 1
  • 6
  • 10
55
votes
7 answers

Android Vector Drawable not support, not support

In icon.svg ERROR@ line 9 is not supported ERROR@ line 10 is not supported How to export this type of svg to vector drawable? Is this even possible? Or should I look for a new svg?
Arka Prava Basu
  • 2,366
  • 3
  • 18
  • 34
1
2 3
47 48