问题描述
我正在自定义通知。我希望标题和内容文本与设备的样式匹配。通知标题文字的颜色是灰色,而不是我的其他通知(黑色系统主题),是白色。这是在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 (将#修改为@)