0

I am trying to make my notification icon large but it is not working anyway.My device is working on Marshmallow. Can anyone tell me how can i make it possible.

In my image chankyastudent have a notification icon it it is not showing completely in only half of part is showing i want it should be appear completely in icon area.
Can anyone tell me.
Thanks in advance
enter image description here

Sushil
  • 1
  • 2
  • 6

2 Answers2

2

use the dimensions of the notification's large icon to create a scaled bitmap

BitmapDrawable contactPicDrawable = (BitmapDrawable) ContactsUtils.getContactPic(mContext, contactId);
    Bitmap contactPic = contactPicDrawable.getBitmap();

    Resources res = mContext.getResources();
    int height = (int) res.getDimension(android.R.dimen.notification_large_icon_height);
    int width = (int) res.getDimension(android.R.dimen.notification_large_icon_width);
    contactPic = Bitmap.createScaledBitmap(contactPic, width, height, false);

set this scaled bitmap as largeIcon it will solve your prblm.

NareshRavva
  • 823
  • 3
  • 21
  • 50
1

First Of All : It is not from Marshmallow, Notification icon started turning out WHITE or displaying it half from Lollipop itself.

Checkout http://developer.android.com/design/style/iconography.html you will see that the white style is how notifications are meant to be displayed in Android Lollipop.

In Android Lollipop, Google also suggests you to use a color that will be displayed behind the (white) notification icon - https://developer.android.com/about/versions/android-5.0-changes.html

You need check your sdk platform is greater than or equal to 23.0.0

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Marshmallow)
{

    notificationBuilder.setSmallIcon(R.drawable.logo);
    notificationBuilder.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.mipmap.logo));
}
Kerberos
  • 4,036
  • 3
  • 36
  • 55
pawan kasar
  • 170
  • 1
  • 6
  • I have tried this but it is not working still i am getting half of image – Sushil Jun 20 '17 at 06:07
  • @Sushil okay please dont check the SDK condition and Use this below code `Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(largeIcon) .setContentText(data) .setContentTitle("Notification from Parse") .setContentIntent(pendingIntent);` – pawan kasar Jun 20 '17 at 06:20
  • still no progress – Sushil Jun 20 '17 at 06:31