Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Colors 更改操作栏颜色无效_Colors_Android Actionbar_Themes - Fatal编程技术网

Colors 更改操作栏颜色无效

Colors 更改操作栏颜色无效,colors,android-actionbar,themes,Colors,Android Actionbar,Themes,我正试图将我的动作条颜色改为皇家蓝,但不管我怎么做,它都是黑色的。我已经在color.xml文件中设置了颜色代码,主题在AndroidManifest.xml中设置为AppTheme。我不知道还有什么会导致它不起作用。以下是my styles.xml: <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> &

我正试图将我的动作条颜色改为皇家蓝,但不管我怎么做,它都是黑色的。我已经在color.xml文件中设置了颜色代码,主题在AndroidManifest.xml中设置为AppTheme。我不知道还有什么会导致它不起作用。以下是my styles.xml:

<!-- Base application theme. -->
<style name="AppTheme"
    parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar">
    <item name="android:background">@color/royal_blue</item>
</style>


@样式/MyActionBar
@颜色/皇家蓝

建议使用“colorPrimary”配置操作栏颜色。您可以使用以下文件进行样式配置。建议您使用工具栏作为操作栏

values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primaryColor</item>
    <item name="colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>  
</style>
   <!-- Application theme to be used -->
<style name="AppTheme" parent="AppTheme.Base"></style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
    <item name="android:colorPrimary">@color/primaryColor</item>
    <item name="android:colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:colorAccent">@color/accentColor</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>   
</style>
</resources>

@颜色/原色
@颜色/原色深色
@颜色/文本颜色主
@颜色/文本颜色辅助
values-v22/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primaryColor</item>
    <item name="colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>  
</style>
   <!-- Application theme to be used -->
<style name="AppTheme" parent="AppTheme.Base"></style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
    <item name="android:colorPrimary">@color/primaryColor</item>
    <item name="android:colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:colorAccent">@color/accentColor</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>   
</style>
</resources>

@颜色/原色
@颜色/原色深色
@颜色/强调色
@颜色/文本颜色主
@颜色/文本颜色辅助
请注意,要在res文件夹中创建另一个名为values-v22的文件夹。这将由棒棒糖设备使用。values/styles.xml将由棒棒糖前设备使用。

建议使用“colorPrimary”配置操作栏颜色。您可以使用以下文件进行样式配置。建议您使用工具栏作为操作栏

values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primaryColor</item>
    <item name="colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>  
</style>
   <!-- Application theme to be used -->
<style name="AppTheme" parent="AppTheme.Base"></style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
    <item name="android:colorPrimary">@color/primaryColor</item>
    <item name="android:colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:colorAccent">@color/accentColor</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>   
</style>
</resources>

@颜色/原色
@颜色/原色深色
@颜色/文本颜色主
@颜色/文本颜色辅助
values-v22/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primaryColor</item>
    <item name="colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>  
</style>
   <!-- Application theme to be used -->
<style name="AppTheme" parent="AppTheme.Base"></style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
    <item name="android:colorPrimary">@color/primaryColor</item>
    <item name="android:colorPrimaryDark">@color/primaryColorDark</item>
    <item name="android:colorAccent">@color/accentColor</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:textColorSecondary">@color/textColorSecondary</item>   
</style>
</resources>

@颜色/原色
@颜色/原色深色
@颜色/强调色
@颜色/文本颜色主
@颜色/文本颜色辅助
请注意,要在res文件夹中创建另一个名为values-v22的文件夹。这将由棒棒糖设备使用。values/styles.xml将由棒棒糖前设备使用