我开始向我的应用添加通知,并希望它在通知抽屉中显示我的应用图标。问题是,图标非常小而且没有填满整个圆圈,它会在它周围留下浅蓝色(TouchWiz,我认为白色库存)边框。像WhatsApp这样的应用程序是如何让它填满整个圈子而不是调整大小?在状态栏中看起来很顺便。
我的代码显示通知:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.widget_icon)
.setContentTitle("My notification")
.setContentText("Hello World!");
Intent resultIntent = new Intent(this, MainActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, mBuilder.build());
答案 0 :(得分:0)
您可以致电public class NotificationIconDrawer {
private Canvas mCanvas;
private Bitmap mBmp;
public NotificationIconDrawer() {
mBmp = Bitmap.createBitmap(yourWidth, yourHeight, Config.RGB_565);
mCanvas = new Canvas(mBmp);
}
public Bitmap draw() {
mCanvas.drawBitmap(bitmap, matrix, paint);
mCanvas.save();
return mBmp;
}
在nofication抽屉中设置图片
{{1}}
如果您对系统提供的图标大小不满意。你可以自己画画。简单的代码如下:
{{1}}
}