android-vectordrawable

How to set VectorDrawable as an image for ImageView programmatically

送分小仙女□ 提交于 2019-12-18 10:48:34
问题 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 this code doesn't work. 回答1: If you want to use vector drawables (less OR greater than API 21) just do the following: Set the image programmatically (e.g. in your activity): imageView.setImageResource(R.drawable.ic_left_arrow_blue); or by XML: app

Vector Drawable in Layer List on Older Android Versions

风流意气都作罢 提交于 2019-12-17 18:25:52
问题 On newer Android versions, the following code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> <solid android:color="#bdbdbd" /> <size android:width="60dp" android:height="60dp" /> </shape> </item> <item android:drawable="@drawable/ic_library_books_black_24dp" android:gravity="center" android:width="40dp" android:height="40dp" > </item> </layer-list> produces this flawlessly: However, earlier

Convert VectorDrawable to SVG [closed]

霸气de小男生 提交于 2019-12-17 17:29:34
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . 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 it. Does anyone have experience with this and what are the steps or

programmatically update android Vector Drawable

丶灬走出姿态 提交于 2019-12-17 16:31:56
问题 I have a VectorDrawable consists of 9 rectangles. This is defined as an XML in the the drawables folder. I have this set as the background for an ImageView that I have declared in xml. android:src="@drawable/squares00" I would like to change the color of one or more of the squares programatically at run time. I know there is way to do this using VectorDrawable animations. But I was wondering if there is simpler way of accessing my vectorDrawable in java, updating its properties (setting one

Support library VectorDrawable Resources$NotFoundException

痞子三分冷 提交于 2019-12-17 15:19:37
问题 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 lower. It is occurring when I use android:drawableLeft or imageView.setImageResource(R.drawable.drawable_image) . And yes, I am putting this on every activity where I am using drawables static { AppCompatDelegate.setCompatVectorFromResourcesEnabled

AppCompat 23.3 Support Vectors no longer work?

安稳与你 提交于 2019-12-17 10:19:24
问题 I was using the support vector drawables added in Support Library 23.2 along with AppCompat. I was using vector drawables both with app:srcCompat and inside a StateListDrawable so I could use them with android:drawableLeft for my TextView. Since upgrading to the 23.3.0 version of AppCompat, only the vectors in app:srcCompat are working. Whenever I reference it the other way I get FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.package.name/

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

扶醉桌前 提交于 2019-12-17 02:33:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . 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 end of having to put multiple

Resources$NotFoundException for ImageView with vector drawable

杀马特。学长 韩版系。学妹 提交于 2019-12-13 14:25:51
问题 I've got crash - Resources$NotFoundException for a vector drawable upon activity creation. Crashes on pre-21. Android Studio 2.1 Support library 24.0.0 Gradle plugin 2.1.0 targetSdk 23 minSdk 15 buildToolsVersion 23.0.2 Debugging on emulator sdk 16 in the app module build.gradle i have: vectorDrawables.useSupportLibrary = true The activity is a subclass of AppCompatActivity . The fragment is a subclass of a support Fragment . In the activity I'm calling: static { AppCompatDelegate

VectorDrawable Rendering issue on API 23

本小妞迷上赌 提交于 2019-12-13 08:40:10
问题 I am facing problem rendering vector on API 23 and but it works fine on below and above API 23 Android, I tried different ways to solve it but couldn't do it I was hope if anyone found a way for that. Android API 24 Screenshot: Android API 23 Screenshot: 回答1: Try to use AppCompatResources.getDrawable(getContext(), yourDrawableResId) 来源: https://stackoverflow.com/questions/45272690/vectordrawable-rendering-issue-on-api-23

Animated Vector Drawable not working with API 15

别来无恙 提交于 2019-12-12 18:40:47
问题 I've been trying to run an Animated Vector Drawable on a device with API level 15. The following is my animated vector "animated_feedback.xml": <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/feedback"> <target android:animation="@animator/background_circle_animator" android:name="BG_White_Circle"/> </animated-vector> The drawable "feedback.xml" contains the following: <vector xmlns:android="http://schemas.android.com/apk/res/android"