自定义通知textViews的样式正确

问题描述

我正在自定义通知。我希望标题内容文本与设备的样式匹配。通知标题文字的颜色是灰色,而不是我的其他通知(黑色系统主题),是白色。这是在Android 11上。有人知道正确的textAppearance或样式适用于自定义通知标题textView吗?

这是我以编程方式构建通知的方式:

notification = new Notification.Builder(this,keptOnByUser? StaticKeys.NOTIFICATION_CHANNEL_ID_KEPT_ON : StaticKeys.NOTIFICATION_CHANNEL_ID_NOT_KEPT_ON)
                .setCustomContentView(notificationViews)
                .setStyle(new Notification.DecoratedCustomViewStyle())
                ...

这是我的简单布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_notification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView_notification_title"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="Title"
        android:textAppearance="@style/TextAppearance.Compat.Notification.Title" />

    <TextView
        android:id="@+id/textView_notification_message"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="Text"
        android:textAppearance="@style/TextAppearance.Compat.Notification" />

</LinearLayout>

</RelativeLayout>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...