2
我有2個remoteViewsAndroid的通知內容不會顯示出來
- 的通知內容
- 的通知股票代碼(這不會工作,我認爲)
我還沒有爲代碼2.一旦我得到內容的工作,我會嘗試2.
代碼低於
Intent intent = new Intent(this, HomeScreen.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.pickupnotification);
RelativeLayout pickupNotificationLayout = (RelativeLayout)this.getLayoutInflater().inflate(R.layout.pickupnotification, null) ;
TextView title = (TextView)pickupNotificationLayout.findViewById(R.id.title) ;
TextView countDown = (TextView)pickupNotificationLayout.findViewById(R.id.countDown) ;
TextView from = (TextView) pickupNotificationLayout.findViewById(R.id.from) ;
TextView to = (TextView) pickupNotificationLayout.findViewById(R.id.to) ;
contentView.apply(this, pickupNotificationLayout);
title.setText("Siddharth" + "2km -> 20km");
countDown.setText("-1:29") ;
from.setText("FROM 2:00pm 14th Jan 2013, Some address") ;
to.setText("TO 4:00pm 14th Jan 2013 Some address") ;
Notification noti = new NotificationCompat.Builder(this).setContent(contentView)
.setSmallIcon(R.drawable.notification_logo)
.setContentIntent(pIntent)
.build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
謝謝。我會嘗試一下並報告。但我解決了我當前的問題,'noti.contentView = contentView;'。我想知道爲什麼setContent不起作用。 – Siddharth
我想知道爲什麼setContent不起作用? – Siddharth
工作!你是對的,我不需要膨脹。但是我仍然不能讓佈局完全顯示它隱藏在標籤背後(通知/快速設置)的內容。 – Siddharth