想问一下。从资源中使用 VectorDrawable 的正确方法是什么?
带有支持库compile 'com.android.support:support-v4:25.1.1'
因为 getDrawable() 已被弃用,当我使用 ContextCompat.getDrawable(this, R.drawable.ic_cancel_button);
时用于设置工具栏导航图像,如下所示
if(toolbar != null)
{
toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_cancel_button));
}
出现错误。
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_cancel_button.xml from drawable resource ID #0x7f02005e
最佳答案
关于android - 在代码中使用资源中的 VectorDrawable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42317465/