答えて
これを行うには、完全な透明イメージを作成し、これをアイコンとして使用します。 :)
ありがとうございますが、私はステータスバーにスペースを取っていません。多分方法はありません... – Meroelyth
Android 4.1(APIレベル16)以降、通知のpriority
を指定することができます。そのフラグをPRIORITY_MIN
に設定すると、通知アイコンがステータスバーに表示されません。
notification.priority = Notification.PRIORITY_MIN;
それともNotification.Builder
を使用する場合は:
builder.setPriority(Notification.PRIORITY_MIN);
あなたは通知のNotificationChannel
IMPORTANCE_MIN
へのimportance
を設定する必要がAndroidの8.0オレオ(APIレベル26)のとおり:
NotificationChannel channel =
new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_MIN);
notificationManager.createNotificationChannel(channel);
...
builder.setChannelId(channel.getId())
ther eはアイコンなしで通知を表示する方法ではありません。
You can use transparent image. But, it take space of icon.
@CommonsWareは:通知を上げるの主なポイントは、ステータスバーにアイコンを置くことですので、それは、このような、インタラクティブでない限り、通常、ステータスバーにアイコンを入れないようにする必要はありません常に実行されるトグルまたは情報通知として、プルダウンすることができますが、アイコンは使用しません。パラメータPRIORITY_MIN
と
.setPriority
これを可能にします。
NotificationCompat notification = new NotificationCompat.Builder(this)
.setContentTitle(getString(R.string.app_name))
.setContentText(getString(R.string.notification_text))
.setSmallIcon(R.mipmap.ic_launcher)
//Show the notification only in NotificationDrawer.
//Notification will not be shown on LockScreen as well as Hidden Icon on StatusBar.
.setPriority(Notification.PRIORITY_MIN)
.build();
@Floernの答えは何ですか? –
@VladMatvienko Mineは、新しい学習者が必要とする場合の完全なコードです。 – zackygaurav
それはあなたがそれを27分編集するまで、昨日ではなかった。前 –
あなたは通知バーに全くのみ通知テキストまたは何をしたいが、あなたはそれをプルダウンする場合にのみ使用透明なイメージそして... –
セットアイコン= 'null'なので – MAC
を意味していますか? – Alabhya