繁体   English   中英

“@android:style / TextAppearance.StatusBar.EventContent.Title”在android L中将颜色设置为白色而不是灰色

[英]“@android:style/TextAppearance.StatusBar.EventContent.Title” sets the color to white instead of grey in android L

Android L使用白色背景作为通知,使用灰色作为文本。 但是, "@android:style/TextAppearance.StatusBar.EventContent.Title"仍然将TextView的颜色设置为与KitKat或以前版本中相同的白色。 它应该返回Android L的新通知样式中使用的灰色。
我该如何解决? 提前致谢。

似乎android-L没有覆盖"@android:style/TextAppearance.StatusBar.EventContent.Title" ,而是引入新风格

<style name="TextAppearance.Material.Notification.Title">
    <item name="textColor">@color/primary_text_default_material_light</item>
    <item name="textSize">@dimen/notification_title_text_size</item>
</style>

我们可以使用基于API的值文件夹来以正确的方式处理它。

/values/styles.xml

<style
    name="NotificationTitle"
    parent="@style/TextAppearance.StatusBar.EventContent.Title" />

/values-21/styles.xml

<style
    name="NotificationTitle"
    parent="@android:style/TextAppearance.Material.Notification.Title" />

现在在TextView调用以下行

android:textAppearance="@style/NotificationTitle"

以下是解决此错误的方法。 styles.xml ,添加以下内容:

    <style name="TextAppearance">
    </style>
    <style name="TextAppearance.StatusBar">
    </style>
    <style name="TextAppearance.StatusBar.EventContent">
        <item name="android:textColor">#ff6b6b6b</item>
    </style>
    <style name="TextAppearance.StatusBar.EventContent.Info">
        <item name="android:textColor">#ff6b6b6b</item>
    </style>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM