【发布时间】:2018-04-05 10:10:29
【问题描述】:
如何从我的应用中的通知布局中删除“现在”和下拉箭头。我正在使用单一布局进行通知,但它正在扩展。我将高度保持在 64dp 和 50dp 但尺寸没有变化
// Get the layouts to use in the custom notification
RemoteViews notificationLayout = new RemoteViews(getPackageName(), R.layout.notification_small);
//RemoteViews notificationLayoutExpanded = new RemoteViews(getPackageName(), R.layout.notification_large);
notificationLayout.setTextViewText(R.id.otpText,otp);
// Apply the layouts to the notification
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext());
builder.setSmallIcon(R.drawable.ic_launcher_foreground)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setPriority(PRIORITY_MAX)
.setDefaults(DEFAULT_SOUND)
.setColor(getResources().getColor(R.color.colorAccent))
.setDefaults(DEFAULT_VIBRATE)
.setContentIntent(pendingIntent);
【问题讨论】:
标签: android timestamp android-notifications