关于矢量图片资源向后兼容:CompatVectorFromResourcesEnabled标志的使用
Posted 淡然为之 坦然受之 泰然处之 奋然斗之
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于矢量图片资源向后兼容:CompatVectorFromResourcesEnabled标志的使用相关的知识,希望对你有一定的参考价值。
StackOverflow上摘抄的:
some things have changed since I asked this question so I will answer it myself.
With Support Library 23.4.0 the support for VectorDrawables from Ressources was reenabled: android Support Library 23.4.0 available now
You can find more information on that in this cast from the Google I/O 2016: What‘s new in the support library - Google I/O 2016
You need to add this to every Activity where you want to use VectorDrawables on devices below Android 5:
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
So you can now use VectorDrawables in DrawableContainers but it can still cause some issues as mentioned in the sources above so use it with caution.
I did not reenable this feature in my app so far but I will change a lot of my icons to VectorDrawables with my next major release and will then dive deeper into this topic.
With Support Library 23.4.0 the support for VectorDrawables from Ressources was reenabled: android Support Library 23.4.0 available now
You can find more information on that in this cast from the Google I/O 2016: What‘s new in the support library - Google I/O 2016
You need to add this to every Activity where you want to use VectorDrawables on devices below Android 5:
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
So you can now use VectorDrawables in DrawableContainers but it can still cause some issues as mentioned in the sources above so use it with caution.
I did not reenable this feature in my app so far but I will change a lot of my icons to VectorDrawables with my next major release and will then dive deeper into this topic.
以上是关于关于矢量图片资源向后兼容:CompatVectorFromResourcesEnabled标志的使用的主要内容,如果未能解决你的问题,请参考以下文章
Android Studio 上的向后兼容性 (AppCompat)