Android JellyBean BigTextStyle通知无法正常工作 –HTC One X AT&T

Android JellyBean BigTextStyle通知无法正常工作 –HTC One X AT&T,第1张

概述我已经实现了一个BigTextStyle/InboxStyle通知,但它显示为正常的通知,它显示在我的HTCOneXAT&T(4.1.1)上的JellyBean(在Gingerbread,ICS等中)之前.甚至动作按钮也未显示.我用模拟器(使用JellyBean4.2)检查我的代码,这是有效的.看起来我的HTCOneX版本没有实现JellyBean的

我已经实现了一个BigTextStyle / InBoxStyle通知,但它显示为正常的通知,它显示在我的HTC One X AT& T(4.1.1)上的JellyBean(在Gingerbread,ICS等中)之前.甚至动作按钮也未显示.

我用模拟器(使用JellyBean 4.2)检查我的代码,这是有效的.

看起来我的HTC One X版本没有实现JellyBean的新Notification System.

HTC One X AT& T设备信息

AndroID Version - 4.1.1 HTC Sense Version - 4+ Software number - 3.18.502.6 710RD HTC SDK API Level - 4.63 HTC Extension version - HTCExtension_Sesnse45_2

源代码

@TargetAPI(Build.VERSION_CODES.JELLY_BEAN)private voID showNotificationJB(Reminder reminder, Intent intent) {    Log.v(TAG, "Showing BigText Notification");    Notification.Builder builder = new Notification.Builder(this);    builder.setContentTitle("Ezeetrak Scheduler");    AdditionalDataStore store = reminder.getStore();     String passedBy = store.optString("passedBy");    builder.setContentText("RecIEved an Event by " + passedBy);    builder.setTicker("RecIEved an Event by " + passedBy);    builder.setSmallicon(R.drawable.ic_launcher);    Notification.InBoxStyle inBoxStyle = new Notification.InBoxStyle();    inBoxStyle.addline(HTML.fromHTML("<b>name: </b>" + reminder.getEventname()));    inBoxStyle.addline(HTML.fromHTML("<b>Date: </b>" + DateTimeHelper.DateFormat.format(reminder.getEventDate())));    inBoxStyle.addline(HTML.fromHTML("<b>Time: </b>" + reminder.getEventTimeFormatted()));    inBoxStyle.addline(HTML.fromHTML("<b>Sent By: </b>" + passedBy));    inBoxStyle.setBigContentTitle("Ezeetrak Scheduler");    builder.setStyle(inBoxStyle);    PendingIntent acceptPendingIntent = buildPendingIntent(ReminderActivity.ACTION_ACCEPT, intent, 0);    PendingIntent rejectPendingIntent = buildPendingIntent(ReminderActivity.ACTION_REJECT, intent, 1);    builder.setContentIntent(buildPendingIntent(ReminderActivity.ACTION_VIEW, intent, 2));    builder.addAction(R.drawable.ic_action_accept, "Accept", acceptPendingIntent);    builder.addAction(R.drawable.ic_action_reject, "Reject", rejectPendingIntent);    builder.setautoCancel(false);    notificationmanager notificationmanager = (notificationmanager) getSystemService(NOTIFICATION_SERVICE);    notificationmanager.notify(REMINDER_SHARE_ACTION, builder.build());}

有谁知道为什么它不能用于我的设备?

解决方法:

AndroID 4.1中的BigTextStyle通知需要两个手指来扩展它.

在AndroID 4.2中,只需要一根手指.请参阅视频以供参考. http://www.youtube.com/watch?v=a6dzMzklEd4

总结

以上是内存溢出为你收集整理的Android JellyBean BigTextStyle通知无法正常工作 – HTC One X AT&T全部内容,希望文章能够帮你解决Android JellyBean BigTextStyle通知无法正常工作 – HTC One X AT&T所遇到的程序开发问题。

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

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

原文地址:https://54852.com/web/1116035.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存