Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the height of remoteview in android notification

I am trying to create a notification with custom RemoteView.But when displaying notification,bottom of the RemoteView is getting cropped.Only half of the remote view is visible in the notification.Could any one tell me about increasing the height of notification in android?

like image 598
user3636647 Avatar asked May 31 '14 09:05

user3636647


1 Answers

First of all, Notification height is limited to 256dp on Android. Views will be clipped at the bottom that exceed this height. Second, to create a custom Big Notification layout, use RemoteViews like this:

    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    builder.setSmallIcon(R.drawable.ic_notification_icon)

    RemoteViews content = new RemoteViews(this.getPackageName(), R.layout.content);

    Notification notif = builder.build();
    notif.bigContentView = content;
    notificationManager.notify(NOTIFICATION_ID, notif);
like image 155
IgorGanapolsky Avatar answered Oct 08 '22 04:10

IgorGanapolsky