【发布时间】:2023-03-08 12:46:01
【问题描述】:
我的问题与this post 完全相同。我希望我的自定义通知文本样式与默认通知匹配(我只是要添加一些额外的视图)。不幸的是,我不完全理解接受的答案。我想我打算添加到 XML 代码中,但不确定到底是什么......
接受的答案说“ 解决方案是使用内置样式。您需要的样式是 TextAppearance.StatusBar.EventContent。只需应用此样式,它将为通知设置默认文本颜色(当然,不要忘记 android: 前缀)。 "
我无法让它工作!在我的自定义通知中,“android:textAppearance="?android:attr/textAppearanceLarge" 行下方有效(因为它放大了文本)但没有达到预期的效果。
这是我的自定义 XML 代码...
<ImageView
android:id="@+id/notImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_alignParentTop="true"/>
<TextView
android:id="@+id/notContentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf ="@id/notImage"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/notContentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below ="@id/notContentTitle"
/>
【问题讨论】:
标签: android notifications styles