android-vectordrawable

Rendering Problems Exception android.graphics.drawable

﹥>﹥吖頭↗ 提交于 2019-11-27 01:48:23
问题 I'm getting this Error : Rendering Problems Exception raised during rendering: android.graphics.drawable.VectorDrawable_Delegate.nDraw(JJJLandroid/graphics/Rect;ZZ) I know that I can change from " N preview" version to "23" and it will work but what I have to do so that it works on "preview"? I tried: clearing and rebuilding installed sdk tools invalidate caches /restart 回答1: You can change the target for the preview in the top right button of the preview area, like in the picture below: Hope

AnimatedVectorDrawable in Support Library and animation of “pathData”

一个人想着一个人 提交于 2019-11-26 23:14:53
问题 I am using animated vectors from Support Library 23.2.0 , like this: compile 'com.android.support:support-vector-drawable:23.2.0' compile 'com.android.support:animated-vector-drawable:23.2.0' I am trying to animate " pathData " (morphing lines one to another). My code looks like this. drawable/ic_done.xml: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportHeight="24.0" android

How to properly use backwards compatible Vector Drawable with the latest Android Support Library?

喜欢而已 提交于 2019-11-26 20:48:31
Vector drawable has been added to Support Library not so long time ago and there were a lot of changes in the API since then: Gradle flags, initializer blocks, selectors, custom XML attributes etc. The question is - how to properly use it now (support lib v25) in these cases: ImageView TextView drawable Menu icon Notification icon XML and programmatically. Add the latest support lib to your app's build.gradle dependencies: compile 'com.android.support:appcompat-v7:26.0.2' and add the following line in the same file: android { ... defaultConfig { ... vectorDrawables.useSupportLibrary = true } .

AppCompat 23.2 use VectorDrawableCompat with RemoteViews (AppWidget) on API<21

旧城冷巷雨未停 提交于 2019-11-26 20:20:41
问题 I have an AppWidget and I'd like to use VectorDrawables in it also on pre-Lollipop devices. VectorDrawableCompat won't work with the RemoteViews I create. To keep my app APK size down, I don't want to add alternative PNG versions of my drawables for older API platforms. How can I do that? 回答1: UPDATE 22/10/2017 As noted by @user924 now AppCompatDrawableManager access is restricted to its own library. ContextCompat.getDrawable(...) should do the trick. UPDATE 05/09/2016 As noted by @kirill

Android Selector Drawable with VectorDrawables srcCompat

半世苍凉 提交于 2019-11-26 18:57:17
问题 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 assigned to. This Drawable holds several VectorDrawables so I thought I should use app:srcCompat for compatibility. But it does not work on my Galaxy S2 with android 4.1.2. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas

Can GradientColor be used to define a gradient for a fill or stroke entirely in XML?

橙三吉。 提交于 2019-11-26 18:13:44
问题 I was looking at the documentation for GradientColor https://developer.android.com/reference/android/R.styleable.html#GradientColor . How can I define a gradient color in XML and apply it to an XML vector drawable? I have tried in color.xml, styles.xml and within an XML vector drawable. I get the error " Failed to convert @id/gradclor into a ColorStateList" with: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="120dp"

Getting Bitmap from vector drawable

一世执手 提交于 2019-11-26 17:19:00
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 a null returned. Here is the sample of code : if (BitmapFactory.decodeResource(arg0.getResources(), R.drawable.vector_menu_objectifs) == null) Log.d("ISNULL", "NULL"); else Log.d("ISNULL", "NOT NULL"); In this sample, when I replace R.drawable.vector_menu_objectifs with a "normal" image, a png for exemple, the result is not null (I get the correct

Change fill color on vector asset in Android Studio

那年仲夏 提交于 2019-11-26 15:05:28
问题 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 change color. Is there a way to do this? <vector android:height="48dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@color/primary"

VectorDrawableCompat Resources$NotFoundException on KitKat and below

为君一笑 提交于 2019-11-26 14:37:24
问题 When I enable vectorDrawables.useSupportLibrary = true I get a lot of resourceNotFoundExceptions on KitKat and below devices. I get this for NavigationView for Menus and also for ImageViews with app:srcCompat android.content.res.Resources$NotFoundException: Resource ID #0x7f02006b at android.content.res.Resources.getValue(Resources.java:2305) at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:268) at android.support.v7.widget

How to change color of vector drawable path on button click

佐手、 提交于 2019-11-26 13:01:51
问题 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 access the name parameter of the vector path? And then change the color. 回答1: Use this to change a path color in your vector drawable VectorChildFinder vector = new VectorChildFinder(this, R.drawable.my_vector, imageView); VectorDrawableCompat