我尝试在我的应用中添加通知。我尝试了下面的代码,但问题是使用下面的代码我只能看到显示的部分文本,即我只看到“导入解压缩的Android项目”在通知的其余部分被剪切关闭。
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentText("Import the unzipped Android project into Eclipse by selecting File")
.setContentTitle(getApplicationContext().getString(R.string.app_name))
.setContentIntent(notifyIntent);
所以我尝试了BigTextStyle,但现在没有显示任何内容。代码如下:
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(getApplicationContext().getString(R.string.app_name))
.setContentIntent(notifyIntent);
NotificationCompat.BigTextStyle textStyle = new NotificationCompat.BigTextStyle();
textStyle.bigText("Import the unzipped Android project into Eclipse by selecting File");
mBuilder.setStyle(textStyle);
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
目标API为15到20,应用程序正在API 15上进行测试。