Since VectorDrawable is only in Android 5.0+, and one would presumably use plain old raster drawables before then, I came up with a scheme.
I put face.png in drawable-nodpi. I put face.xml in drawable-v21 Then, when I need the drawable in my custom view, I call. Drawable drawFace =getResources().getDrawable(R.drawable.face); I sure thought I was clever. So of course, this will retrieve a VectorDrawable if it is running on Android 5.0 or later, and a BitmapDrawable if it is running on 4.4 or earlier, right? Nope. I debugged on a Nexus 9. The type of the returned Drawable was BitmapDrawable. To add to the mystery, I debugged on Android Wear device with Android 5.0 The drawable comes up as a VectorDrawable, just as I wanted. Why wouldn't that happen on a tablet with Android 5.0? The targetSDK is 21. The BuildTools version is 21.1.1. The minimum SDK is 17. The VectorDrawable class has only a default constructor. I don't know how to force a VectorDrawable to load if I went that route. Nathan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.