use*_*605 18 notifications android android-5.0-lollipop
我在Lollipop中的自定义通知背景颜色有问题.它是黑色的应该是白色的.textColor没问题:
我正在使用
<resources>
<style name="NotificationText" parent="android:TextAppearance.StatusBar.EventContent" />
<style name="NotificationTitle" parent="android:TextAppearance.StatusBar.EventContent.Title" />
</resources>
Run Code Online (Sandbox Code Playgroud)
知道如何使用设备默认主题颜色进行自定义通知吗?
你的应用程序的targetSdkVersion必须是21.
正如Ahmed的回答一样,在values-21文件夹中添加另一个样式文件.
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="NotificationText" parent="android:TextAppearance.Material.Notification" />
<style name="NotificationTitle" parent="android:TextAppearance.Material.Notification.Title" />
<style name="NotificationTime" parent="android:TextAppearance.Material.Notification.Time" />
</resources>
Run Code Online (Sandbox Code Playgroud)
无论出于何种原因,Lollipop都有新款式.把它放在values-v21/styles.xml中:
<resources>
<style name="NotificationTitle" parent="android:TextAppearance.Material.Notification.Title"></style>
<style name="NotificationText" parent="android:TextAppearance.Material.Notification"></style>
</resources>
Run Code Online (Sandbox Code Playgroud)
Bar*_*ine -1
我不确定背景的主题是什么,但我只是在 xml 中将自定义布局(小视图和大视图)的背景设置为深色。这与 Lollipop 之前的通知更加匹配。
我觉得奇怪的是,当标准通知颜色为白色时, android:TextAppearance.StatusBar.EventContent.Title 的外观不会调整为 Lollipop 的深色!
| 归档时间: |
|
| 查看次数: |
7777 次 |
| 最近记录: |