2

I am trying to make notification like this. Tried different codes for this.

Here is a code :

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,
            "AppLock007")
            .setSmallIcon(R.drawable.ic_lock)
            .setColor(Color.TRANSPARENT)
            .setContentTitle("App Lock")
            .setContentText("Securing your apps")
            .setOngoing(true)
            .setContentIntent(pendingIntent);

Notification notification = notificationBuilder.build();

Is there any solution code to create notification like in above image?

Jayesh Rathod
  • 600
  • 1
  • 5
  • 18
  • I think a "small" notification is caused by a low importance level of the notification in Android 8 and above. Try to use notification channels as described [here](https://developer.android.com/guide/topics/ui/notifiers/notifications#importance). – Sandrogo Feb 28 '19 at 09:59
  • Tried but still notification is not exact like this. Its still showing big space! Please give example code :( – Jayesh Rathod Feb 28 '19 at 10:05
  • add custom view for notification. u can check the link https://stackoverflow.com/questions/41888161/how-to-create-a-custom-notification-layout-in-android – Solaiman Hossain Feb 28 '19 at 10:26
  • Well its not need to set custom view but setSubText() is working fine! – Jayesh Rathod Feb 28 '19 at 10:58

0 Answers0