android – 自定义通知最大高度?

android – 自定义通知最大高度?,第1张

概述我正在尝试制作自定义通知,但它总是很小(大约是大多数通知的大小).我可以看到Netflix和Youtube在投射到chromecast设备时会显示更大的通知,这些通知看起来是自定义的(它们可能是大视图).他们如何让他们变得那么大? 谢谢. 编辑:由于评论指出bigContentView,将其标记为已回答 你似乎已经知道了…你可能正在谈论大视图风格的通知.谷歌有 specific training 我正在尝试制作自定义通知,但它总是很小(大约是大多数通知的大小).我可以看到Netflix和Youtube在投射到Chromecast设备时会显示更大的通知,这些通知看起来是自定义的(它们可能是大视图).他们如何让他们变得那么大?

谢谢.

编辑:由于评论指出bigContentView,将其标记为已回答

解决方法 你似乎已经知道了…你可能正在谈论大视图风格的通知.谷歌有 specific training documentation以及 a technical guide.这是一些示例代码:

// Constructs the Builder object.NotificationCompat.Builder builder =        new NotificationCompat.Builder(this)        .setSmallicon(R.drawable.ic_stat_notification)        .setContentTitle(getString(R.string.notification))        .setContentText(getString(R.string.Ping))        .setDefaults(Notification.DEFAulT_ALL) // requires VIBRATE permission        /*         * Sets the big vIEw "big text" style and supplIEs the         * text (the user's reminder message) that will be displayed         * in the detail area of the expanded notification.         * These calls are ignored by the support library for         * pre-4.1 devices.         */        .setStyle(new NotificationCompat.BigTextStyle()                .bigText(msg))        .addAction (R.drawable.ic_stat_dismiss,getString(R.string.dismiss),pidismiss)        .addAction (R.drawable.ic_stat_snooze,getString(R.string.snooze),piSnooze);

注意对setStyle的调用.

总结

以上是内存溢出为你收集整理的android – 自定义通知最大高度?全部内容,希望文章能够帮你解决android – 自定义通知最大高度?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1127537.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存