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

How to change Android Theme color (colorPrimaryDark) in reactjs

我是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 代码,但它给我错误;

No resource found that matches the given name (at 'android:colorPrimaryDark' with value '@color/#ec6d7e')

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

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

添加你的颜色,像这样:

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

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