2014-11-11 18 views
7

Android L sử dụng nền trắng cho thông báo và màu xám cho văn bản trên đó. Tuy nhiên, "@android:style/TextAppearance.StatusBar.EventContent.Title" vẫn đặt màu là TextView thành màu trắng giống như trong KitKat hoặc các phiên bản trước. Nó sẽ trả về màu xám được sử dụng trong kiểu thông báo mới của Android L.
Tôi có thể giải quyết nó bằng cách nào? Cảm ơn trước."@android: style/TextAppearance.StatusBar.EventContent.Title" đặt màu thành trắng thay vì màu xám trong android L

Trả lời

7

Dường như android-L không ghi đè "@android:style/TextAppearance.StatusBar.EventContent.Title", thay vì giới thiệu phong cách mới

<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> 
1

Chúng ta có thể tận dụng cả API giá trị dựa trên các thư mục để xử lý này theo cách thích hợp.

/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" /> 

Bây giờ gọi dòng sau trong bạn TextView

android:textAppearance="@style/NotificationTitle" 
Các vấn đề liên quan