Wollte fragen. Was ist der richtige Weg, um VectorDrawable aus Ressourcen zu verwenden? mit Support-Bibliothek compile 'com.android.support:support-v4:25.1.1'
Verwenden von VectorDrawable aus Ressourcen in Code
Da getDrawable() ist veraltet und wenn ich ContextCompat.getDrawable(this, R.drawable.ic_cancel_button);
für
if(toolbar != null)
{
toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_cancel_button));
}
Der Fehler occures wie diese Symbolleiste Navigationsbild einstellen.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_cancel_button.xml from drawable resource ID #0x7f02005e
Sie können dies verwenden: ResourcesCompat.getDrawable (getResources(), R.drawable.your_drawable, null) –