2016-08-01 6 views
0

私はAndroid Appにカラフルでカスタマイズされた通知を実装したいと思います。Androidのカラフルな通知の写真

私は色を実装しようとしましたが、現時点では背景色のみを設定できます。私はこの種の結果に到達したい: enter image description here

私のアプリの画像を拡大して通知写真として表示します。ここで

現時点では私のコード:

return builder.setContentTitle("APP TITLE") 
       .setContentText("Some texts") 
       .setSmallIcon(R.mipmap.ic_launcher) 
       .setContentIntent(pendingIntent) 
       .setOngoing(true) 
       .setAutoCancel(true)   
       .setVisibility(Notification.VISIBILITY_PUBLIC) 
       .setPriority(Notification.PRIORITY_HIGH) 
       .setCategory(Notification.CATEGORY_ALARM) 
       .setOnlyAlertOnce(false) 
       .setColor(getResources().getColor(R.color.colorPrimary)); 

がどのように私は上記の投稿、ハングアウトの一例として、カラフルなアイコン通知を実装することができますか?

答えて

1
mNotifyBuilder = new NotificationCompat.Builder(this) 
       .setContentTitle(getResources().getString(R.string.app_name)) 
       .setContentText(messs) 
       .setLargeIcon(bitmap) 
       .setSmallIcon(R.mipmap.hangouts_launcher) 
       .setStyle(new NotificationCompat.BigTextStyle().bigText(message)); 
mNotifyBuilder.setContentIntent(pIntent); 
// Set Vibrate, Sound and Light            
     int defaults = 0; 
     defaults = defaults | Notification.DEFAULT_LIGHTS; 
     defaults = defaults | Notification.DEFAULT_VIBRATE; 
     defaults = defaults | Notification.DEFAULT_SOUND; 
     mNotifyBuilder.setDefaults(defaults); 
     // Set the content for Notification 
     mNotifyBuilder.setContentText(messs); 
mNotificationManager.notify(m, mNotifyBuilder.build()); 
関連する問題