【问题标题】:How to change Android Theme color (colorPrimaryDark) in reactjs如何在 reactjs 中更改 Android 主题颜色(colorPrimaryDark)
【发布时间】:2017-12-16 20:53:01
【问题描述】:

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

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

请帮助更改主题颜色,在此先感谢

【问题讨论】:

    标签: android reactjs android-room


    【解决方案1】:

    导航到app &gt; src &gt; main &gt; res &gt; values 并创建colors.xml

    添加你的颜色,像这样:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-22
      相关资源
      最近更新 更多