小编dig*_*gin的帖子

带有彩色字符串的 Android 通知 InboxStyle()

android InboxStyle() 的快速问题,我可以有一个彩色的字符串吗?我尝试使用Spannable

NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
text = "sample";
Spannable spannable = new SpannableString(text);
spannable.setSpan(new ForegroundColorSpan(Color.GREEN), 0, text.length(), 0);
style.addLine(spannable);
Run Code Online (Sandbox Code Playgroud)

但没有运气... :(

我可以添加颜色吗?谢谢!

string notifications android colors spannable

2
推荐指数
1
解决办法
1059
查看次数

标签 统计

android ×1

colors ×1

notifications ×1

spannable ×1

string ×1