Nie mogę utworzyć powiadomienia w stylu Big View. Wspierać problemy z biblioteką? Mój kod jest w porządku w Eclipse (bez błędów), ale powiadomienie pokazuje tylko zawartośćTytuł, ContentText, ikona ... to wszystko! Brak dodatkowych linii w moim powiadomieniu ... Co jest nie tak? Dziękuję bardzo za odpowiedź. Oto kod ...Nie mogę ustawić stylów widoku Big View
@Override
protected void onMessage(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
//Log.d("onMessage", String.valueOf(arg1));
//Log.d("onMessage", "Receive a message");
// Get the data from intent and send to notification bar
String message = arg1.getExtras().getString("message");
generateNotification3(arg0, message);
}
private static void generateNotification3(Context context, String message) {
NotificationCompat.Builder mbuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("lolo")
.setContentText("text")
.setDefaults(Notification.DEFAULT_ALL) // requires VIBRATE permission
/*
* Sets the big view "big text" style and supplies the
* text (the user's reminder message) that will be displayed
* in the detail area of the expanded notification.
* These calls are ignored by the support library for
* pre-4.1 devices.
*/
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(message));
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(context, Fsa.class);
// The stack builder object will contain an artificial back stack for
// the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(Fsa.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);
mbuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(100, mbuilder.build());
}
Czy próbowałeś ręcznie powiększyć powiadomienie (dotknij dwoma palcami obok siebie i przeciągnij w dół)? Powiadomienia będą automatycznie rozwijane tylko wtedy, gdy pojawią się u góry listy. – dsandler
Gosh! masz rację !!! Doskonały !!!! Czy istnieje sposób, aby rozszerzyć go programowo? Dodałem .setOngoing (true) (na górę), ale nie jest ono rozwinięte ... (nie jest to naprawdę szczyt, ponieważ pierwszym jest powiadomienie, gdy podłączam się do USB w celu rozwijania narzędzi). Jeszcze raz dziękuję przyjacielu! – Kris88
Nie, nie ma sposobu, aby go rozszerzyć programowo. Chodzi o to, że polityka ekspansji zależy od użytkownika i interfejsu systemu; aplikacje powinny po prostu dostarczać dane. – dsandler