gpt4 book ai didi

android - 使 Android Wear 通知在没有操作图标的情况下可点击

转载 作者:行者123 更新时间:2023-11-30 02:25:00 26 4
gpt4 key购买 nike

我正在从 watch 发送通知,我希望该通知可点击,即点击时它会打开一个 Activity 。这是它的样子

notification
(来源:macnn.com)

但是,我不想显示播放图标,只想要简单的通知外观。即使我设置了一个空的 Action 图标,图标空间仍然被占用,我无法将文本放入该空间。有没有办法释放图标空间以显示文本?

代码如下:

NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Tracking")
.setContentText("Tap to open.")
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.launchbg))
.setLocalOnly(true)
.addAction(R.drawable.empty_icon, "blah", pendingSaveIntent)
.extend(new NotificationCompat.WearableExtender()
.setContentAction(0));

最佳答案

setHintHideIcon(true)隐藏图标。

NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Tracking")
.setContentText("Tap to open.")
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.launchbg))
.setLocalOnly(true)
.addAction(R.drawable.empty_icon, "blah", pendingSaveIntent)
.extend(new NotificationCompat.WearableExtender()
.setHintHideIcon(true)
.setContentAction(0));

关于android - 使 Android Wear 通知在没有操作图标的情况下可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27994953/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com