use*_*647 7 android statusbar android-layout android-notifications
我正在尝试使用自定义RemoteView.But创建通知,当显示通知时,RemoteView的底部正在被裁剪.只有一半的远程视图在通知中可见.可以告诉我有关增加android中通知的高度吗?
首先,Android上的通知高度限制为256dp。视图将在超过此高度的底部被剪切。其次,要创建自定义的Big Notification布局,请使用如下所示的RemoteViews:
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);
Run Code Online (Sandbox Code Playgroud)
将通知意图的样式设置为bigstyle,
Notification noti = new Notification.Builder(this).setStyle(new Notification.BigTextStyle().bigText(longText))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6234 次 |
| 最近记录: |