Support library VectorDrawable Resources$NotFoundException

前端 未结 14 1347
你的背包
你的背包 2020-11-29 18:40

I am using Design Support Library version 23.4.0. I have enabled the gradle flag:

defaultConfig {
    vectorDrawables.useSupportLibrary = tr         


        
14条回答
  •  萌比男神i
    2020-11-29 18:41

    Try using:

    imageView.setImageDrawable(VectorDrawableCompat.create(getResources(), drawableRes, null));
    

    You don't have to add AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); this way.

    Just inflate your vector drawables using VectorDrawableCompat and you're all set.

提交回复
热议问题