我正在尝试使用自定义bigContentView正在进行的通知。没有bigContenView的自定义RemoteView可以正常工作。但是,当我尝试将这个bigContentView添加到它时,Eclipse说
" bigContentView无法解析或不是字段"
有人可以帮帮我吗?
这是我的代码:
public void PlayTimeOnGoingProgressStatusBar() {
NotificationCompat.Builder OnGoingProgress = new NotificationCompat.Builder(this);
RemoteViews remotetView = new RemoteViews(getPackageName(), R.layout.custom_notification);
OnGoingProgress.setSmallIcon(R.drawable.app_name).setContent(remotetView);
OnGoingProgress.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
OnGoingProgress.setContent(remotetView); //Place all custom notifications to here
OnGoingProgress.setOngoing(true); //Create OnGoing Status Bar
OnGoingProgress.setAutoCancel(false);
OnGoingProgress.bigContentView = remotetView; //THIS IS THE ONE THAT GIVES ME PROBLEM
remotetView.setTextViewText(R.id.App_name, “Test”);
remotetView.setProgressBar(R.id.status_progress, total_time, current_prgoress, false);
NotificationManager.notify(PROGRESS_STATUS_BAR_ID, OnGoingProgress.build());
}
非常感谢您提前
答案 0 :(得分:1)
请改用:
Notification note = OnGoingProgress.build();
note.bigContentView = remoteView;
NotificationManager.notify(... note);
原因:大内容视图是通知类的字段,而不是构建器类。