我寫的,可以點擊通知時,像圖片1觸發對話活動。但是,如果啓動器活動位於堆棧中,它將出現在對話框的下方,就像圖片2一樣。如果沒有,對話框活動將單獨顯示,這是我想要的,如圖片3。 有人能告訴我爲什麼嗎?
對話活動採用像下面的自定義樣式:
<style name="DialogTransparent" parent="Theme.AppCompat.Light.Dialog">
<item name="windowNoTitle">true</item>
</style>
,下面將通知製造商代碼:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this).setAutoCancel(false).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.todo_logo)).setSmallIcon(getNotificationIcon()).setContentText(getString(R.string.notificatioin_new_task)).setOngoing(true);
Intent alarmIntent = new Intent(this, DialogEventActivity.class);
PendingIntent alarmPendingIntent = PendingIntent.getActivity(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(alarmPendingIntent);
manager.notify(NEW_NOTIFICATION_ID, mBuilder.build());
我覺得活動的代碼是無關的,對嗎?
你真的需要張貼您的相關代碼。 –
@Yvette發佈。對不起,我的疏忽...... – Cheng
沒關係,你可以將你的啓動器活動的可見性設置爲消失。 –