相关疑难解决方法(0)

NotificationCompat 4.1 SetSmallIcon和SetLargeIcon

我使用这个简单的代码在Android 4.1或更高版本中设置通知.它工作得很好,但我的问题是SmallIcon和LargeIcon.我知道SmallIcon显示在状态栏中,LargeIcon显示在下拉列表中.

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setTicker("The ticker");
builder.setContentTitle("The title");
builder.setContentText("The text");
builder.setSmallIcon(R.drawable.my_small_icon);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.my_96px_large_icon);
builder.setLargeIcon(bm);       
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify("direct_tag", NOTIF_ALERTA_ID, builder.build());
Run Code Online (Sandbox Code Playgroud)

我的问题是:

  1. 启动通知后,"The Ticker"文本旁边会显示一个裁剪的超大小图标,而不是显示原始SmallIcon而不会过大. 在此输入图像描述

  2. 在下拉列表中,我看到左边的LargeIcon,这很好.但是我也会在通知时间旁边看到右边的小图标.我不想表明这一点. 在此输入图像描述

notifications icons android

36
推荐指数
3
解决办法
6万
查看次数

标签 统计

android ×1

icons ×1

notifications ×1