API级别10中的自定义大通知
问题描述:
我正在使用自定义视图进行通知。
在这种情况下,我知道对于大尺寸的通知,我必须使用bigContentView
并为其设置一个大视图。 每一件事情是API 16好,但我的应用程序最小的SDK API级别10和bigContentView
没有在API级别10
API级别10中的自定义大通知
myNotification= notification.setContentTitle("some string")
.setContentText("some text")
.setSmallIcon(R.mipmap.ic_launcher)
.build();
RemoteViews notificationView = new RemoteViews(MyApp.getAppContext().getPackageName(),
R.layout.custom_notification_layout);
myNotification.bigContentView=notificationView; //Error in this line!
是否有另一种为自定义通知显示大布局的支持?
或者是旧版本bigContentView
?
答
通知的大视图是在Android 4.1中引入的,它们在旧设备上不受支持。 (如@Pop铎注释)
我们可以通过
bigContentView(RemteView)
如果API级是大于15在API 15或更低上使用它的通知,我们只能为通知定制视图通过
contentView(View)
方法。
bigContentView在API级别16> http://www.androiddev.ir/reference/android/app/Notification.html – Criss
感谢@Criss但我的应用程序分钟SDK是10遗憾的是API 10不支持大视图,但对于我使用'Notification.contentView'的自定义视图。 – Seyyed
嗨!你有没有找到你的答案?我不认为在Android 4.1中引入Big视图是可能的,并且它们在旧设备上不受支持(http://developer.android.com/training/notify-user/expanded.html)第二段 – Tudor