如何在reactjs中更改Android主题颜色(colorPrimaryDark)

时间:2017-08-22 06:28:04

标签: android reactjs android-room

我是android开发的新手,我想改变主题颜色

<!-- change it from here theme color. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@android:color/white</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:colorEdgeEffect">@color/lightBlue</item>

    <item name="actionMenuTextColor">@android:color/white</item>

    <!-- active thumb & track color (30% transparency) -->
    <item name="colorControlActivated">@color/colorAccent</item>

</style>

<style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColorPrimary">#333333</item>
</style>

这是我的颜色代码:#ec6d7e

我想在colorPrimaryDark中设置#ec6d7e代码,但它给了我错误;

  

找不到与给定名称匹配的资源(at   'android:colorPrimaryDark'的值为'@ color /#ec6d7e')

请帮助更改主题颜色,提前致谢

1 个答案:

答案 0 :(得分:3)

导航至app > src > main > res > values并创建colors.xml

添加颜色,如下:

<resources>
    <color name="colorPrimaryDark">#ec6d7e</color>
</resources>

然后您就可以通过@color/colorPrimaryDark引用它。