您的位置:首页 > 其它

音乐播放时在通知栏显示大小不同的 notification

2013-07-16 17:36 134 查看
// 创建 remote 对象,一个普通的,一个展开的,remoteViews 的layout有特殊要求,看看文档
RemoteViews views = new RemoteViews(getPackageName(), R.layout.status_bar);
RemoteViews bigViews = new RemoteViews(getPackageName(), R.layout.status_bar_expanded);

status =
new Notification.Builder(this).build();
status.contentView = views;
status.bigContentView = bigViews;
status.flags = Notification.FLAG_ONGOING_EVENT;
status.icon = R.drawable.stat_notify_music; // 一定要写,否则通知栏就不出现 notification

status.contentIntent = PendingIntent
.getActivity(this, 0,
new Intent("com.andrew.apolloMod.PLAYBACK_VIEWER")
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
startForeground(PLAYBACKSERVICE_STATUS,
status);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: