【发布时间】:2019-06-26 04:14:51
【问题描述】:
在我的 NativeScript 项目中,我在 App_Resources/Android/src/main/res/values/colors.xml 中定义了一种颜色:
<resources>
...
<color name="notification">#00546A</color>
</resources>
现在我尝试像这样访问定义颜色的值:
utils.ad.getApplicationContext().getResources().getColor(
android.R.color.notification,
null
)
但我总是得到:
android.content.res.Resources&NotFoundException:资源 ID #0x0
我也试过了:
android.support.v4.content.ContextCompat.getColor(
utils.ad.getApplicationContext(),
android.R.color.notification
)
...但结果相同。
有人有提示吗?
【问题讨论】:
标签: android colors resources nativescript