この単純なコードを使用して、Android4.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());
私の問題は:
通知が開始されると、元のSmallIconをサイズ変更せずに表示するのではなく、トリミングされた特大のSmallアイコンが「TheTicker」テキストの横に表示されます。
ドロップダウンリストの左側にLargeIconが表示されていますが、これは良いことです。ただし、右側の通知時刻の横にある小さなアイコンも表示されます。私はそれを見せたくありません。