【问题标题】:Android set textcolor of actionbar, example not workingAndroid设置操作栏的文本颜色,示例不起作用
【发布时间】:2014-02-16 11:22:59
【问题描述】:

这已经发布过,但我仍然无法弄清楚。我想更改操作栏的文本颜色,最好以编程方式更改(这甚至可能吗?)。

我查看了以下示例: https://developer.android.com/training/basics/actionbar/styling.html 但我得到“或:检索项目的父项时出错:找不到与给定名称'@style/Theme.Holo'匹配的资源。”

我正在使用仅适用于 Android 3.0 及更高版本:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.Holo">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="android:actionMenuTextColor">@color/actionbar_text</item>
    </style>
    ...

没有更简单的方法吗?我的意思是你可以得到actionbar,但似乎没有方法.setTextColor,为什么不呢?

【问题讨论】:

    标签: android android-actionbar


    【解决方案1】:

    代替

    parent="@style/Theme.Holo"
    

    使用

    parent="@android:style/Theme.Holo
    

    【讨论】:

      【解决方案2】:

      您的样式目录中有 Theme.Holo 吗?否则你可能想使用@android:style/Theme.Holo

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-09-11
        • 1970-01-01
        • 1970-01-01
        • 2015-08-22
        • 1970-01-01
        • 1970-01-01
        • 2023-03-18
        • 1970-01-01
        相关资源
        最近更新 更多