【发布时间】:2016-10-09 01:35:12
【问题描述】:
From these answers, I suppose I know how to grab the primary color。但是,当我尝试设置工具栏的背景颜色时,我不断收到异常,即找不到我指定的颜色的 resourceId
android.content.res.Resources$NotFoundException: Resource ID ...
我试过了
toolbar.setBackgroundResource(primaryColor);
我试过了
toolbar.setBackgroundColor(primaryColor);
【问题讨论】:
-
toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.primaryColor));
标签: android android-layout android-toolbar