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

645 questions
193
votes
13 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…
Patrick
  • 14,618
  • 20
  • 77
  • 136
150
votes
12 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
  • 1,962
  • 2
  • 12
  • 22
127
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…
113
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
  • 6,855
  • 8
  • 46
  • 53
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
  • 106,412
  • 122
  • 641
  • 1,128
78
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
  • 38,958
  • 59
  • 205
  • 324
75
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,289
  • 1
  • 14
  • 32
72
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
  • 8,747
  • 8
  • 51
  • 79
72
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…
69
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…
67
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
  • 741
  • 1
  • 5
  • 12
62
votes
7 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
  • 873
  • 2
  • 10
  • 20
50
votes
11 answers

Why is my SVG failing to load in Vector Asset Studio

The SVG below is failing to open in Android Studio's Vector Asset Studio in resulting in the error: "Empty preview image! EXCEPTION in parsing TareSymbol.svg: For input string: "8.7337904mm"Exception while parsing XML file: Premature end of file."…
Luke Allison
  • 2,644
  • 3
  • 18
  • 36
48
votes
9 answers

How to change color of vector drawable path on button click

With the new android support update, vector drawables get backward compatibility. I have a vector image with various paths. I want the color of the paths to change on click of a button or programmatically based on an input value. Is it possible to…
suku
  • 8,833
  • 13
  • 57
  • 108
46
votes
7 answers

SplashScreen with Vector stretched full screen

I did my splash screen with this tutorial and it works great: https://www.bignerdranch.com/blog/splash-screens-the-right-way/ Basically I set up a splascreen through theme: