I am trying to create a custom ongoing notification whose height is about 200dp (less than 256) but only a normal notification (64dp) appears in the notification drawer. I can't even expand it.
I create the notification like that :
button3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.custom_notification);
remoteViews.setImageViewResource(R.id.notif3_image, R.drawable.ic_action_add_group);
remoteViews.setTextViewText(R.id.notif3_title, "My custom notification title");
remoteViews.setTextViewText(R.id.notif3_text, "My custom notification text");
PendingIntent pendingIntent = PendingIntent.getActivity(
MainActivity.this, 0,
new Intent(MainActivity.this, MainActivity.class), 0);
Notification.Builder notificationBuilder = new Notification.Builder(MainActivity.this)
.setContent(remoteViews)
.setSmallIcon(R.drawable.ic_podcast1)
.setOngoing(true)
.setContentIntent(pendingIntent);
Notification notification = notificationBuilder.build() ;
notificationManager.notify(33, notification);
}
});
Thanks for you help
0 comments:
Post a Comment