簡體   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