带有黑暗工具栏的Android Theme.AppCompat.Light(用于浅色文字)

 caozhizhao 发布于 2022-12-04 16:13

我有一个应用程序Theme.AppCompat.Light,我需要使用它,所以Dialogs有轻主题.但这会使我的工具栏中的文字变黑,我宁愿它变成白色.我试过设置工具栏的具体app:themeAppCompat.Dark.Actionbar,但没有运气...我搜索了一段时间,但没有找到一个具体的问题和答案.

这是我的默认AppTheme:


这是我的toolbar.xml:


reVerse.. 17

要更改标题中的标题颜色,Toolbar只需将属性添加android:textColorPrimary工具栏样式即可.

有关工具栏的更多属性,请参阅以下示例.


结果

结果的图片

1 个回答
  • 要更改标题中的标题颜色,Toolbar只需将属性添加android:textColorPrimary工具栏样式即可.

    有关工具栏的更多属性,请参阅以下示例.

    <style name="MyToolbarStyle" parent="ThemeOverlay.AppCompat.ActionBar">
        <!-- Used to for the title of the Toolbar -->
        <item name="android:textColorPrimary">#fff</item>
        <!-- Used to for the title of the Toolbar when parent is Theme.AppCompat.Light -->
        <item name="android:textColorPrimaryInverse">#fff</item>
        <!-- Used to color the text of the action menu icons -->
        <item name="android:textColorSecondary">#fff</item>
        <!-- Used to color the overflow menu icon -->
        <item name="actionMenuTextColor">#fff</item>
        <!-- Color of the Toolbar -->
        <item name="android:background">#455a64</item>
    </style>
    

    结果

    结果的图片

    2022-12-11 02:07 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有