首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用自定义通知时未显示标题

使用自定义通知时未显示标题
EN

Stack Overflow用户
提问于 2018-01-04 18:12:29
回答 1查看 306关注 0票数 0

我在Android Studio中使用带有自定义通知的RemoteViews。唯一的问题是,我现在有问题,它显示小图标和应用程序的名称。

谢谢,希望我说得有道理吧?

代码语言:javascript
运行
复制
Intent notificationIntent = new Intent(mContext, CardDemoActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent pendingIntent = PendingIntent.getActivity(mContext,0,notificationIntent,0);
RemoteViews remoteView = new RemoteViews(mContext.getPackageName(), R.layout.notifcation_player);
remoteView.setImageViewResource(R.id.notif_appIcon, R.drawable.app_logo);
remoteView.setTextViewText(R.id.notif_playing, title);
remoteView.setTextViewText(R.id.notif_preacher, preacher);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext);
mBuilder.setSmallIcon(R.drawable.app_logo);
mBuilder.setContent(remoteView);
mBuilder.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(mContext.NOTIFICATION_SERVICE);
notificationManager.notify(1, mBuilder.build());
EN

回答 1

Stack Overflow用户

发布于 2018-01-04 18:22:23

使用-:

代码语言:javascript
运行
复制
mBuilder.setContentTitle("Your tilte");  //title for your project
mBuildersetContentText("Your message);//message you want to show
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48093007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档