我在 Corona 中收到了一些通知。问题是,文本太大,我需要显示更大(多行)的通知,例如 Gmail 应用程序。这是通知现在的样子:
这是我的代码:
local notificationOptions =
{
alert = text,
badge = 2,
sound = "alarm.caf",
custom = { foo = "bar" }
}
local notification = notifications.scheduleNotification( nextScheduleTime + ( day + math.floor(day/7)) * 24 * 60 * 60, notificationOptions )
知道怎么做吗?
最佳答案
通知默认不提供多行。
要使用多行,您必须在 Java 中使用 NotificationCompat.BigTextStyle()
(sample) 或使用自定义或 native 自定义 View (example)。
不幸的是,我没有找到如何触摸默认 View 以覆盖
手册: https://docs.coronalabs.com/daily/guide/events/appNotification/index.html#TOC
这里: https://docs.coronalabs.com/daily/plugin/notifications/scheduleNotification.html
在第二个链接中,您可以看到仅使用了以下属性:
alert (optional) String. The notification message to be displayed to the user. If the application is not currently running, a system alert will display this message. badge (optional) Number. The badge number to be displayed on the application icon when the scheduled notification triggers. This replaces the last badge number that was applied. Set to 0 to omit the badge number. This option is not supported on Android. sound (optional) String. Name of the sound file in the system.ResourceDirectory to be played when the scheduled notification triggers. This sound is only played if the app is not currently in the foreground. On iOS, there are limitations on the kinds of sound that can be played (consult Apple's documentation for more details). custom (optional) Table. A table that will be delivered with the notification event. This allows you to pass custom information with the notification.
总而言之,目前还没有合适的方法。
关于android - Corona SDK 显示多行通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39431350/