android-vectordrawable

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

徘徊边缘 提交于 2019-11-26 12:47:43
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 files into multiple folders ( mdpi , hdpi , xhdpi , etc). That would be great and might minimize apps sizes on some cases. The questions I'd like to ask a few questions regarding this new class: Is it possible to use it in older Android versions, maybe via a library of even the support library of Google? I'm not

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

▼魔方 西西 提交于 2019-11-26 07:45:12
问题 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. 回答1: Add the latest support lib to your app's build.gradle dependencies: compile 'com.android.support:appcompat-v7:26.0.2' and add the

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

最后都变了- 提交于 2019-11-26 05:53:16
问题 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 using Gradle 1.5 Support Library 23.2 (\'com.android.support:appcompat-v7:23.2.0\') What I have found though is that I can programmatically assign SVG\'s in Java without crashes like this. TextView tv = (TextView) findViewById(R.id.textView);

Getting Bitmap from vector drawable

*爱你&永不变心* 提交于 2019-11-26 04:39:05
问题 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