मुझे एंड्रॉइड में डिफ़ॉल्ट अधिसूचना के बजाय एक कस्टम अधिसूचना बनाने की आवश्यकता है। वर्तमान अधिसूचना की तरह छविएंड्रॉइड में कस्टम अधिसूचना कैसे बनाएं
नीचे मैं इसे पसंद को अनुकूलित चाहते हैं एक आइकन, शीर्षक और संदेश है इस
मैं कैसे इस
मुझे एंड्रॉइड में डिफ़ॉल्ट अधिसूचना के बजाय एक कस्टम अधिसूचना बनाने की आवश्यकता है। वर्तमान अधिसूचना की तरह छविएंड्रॉइड में कस्टम अधिसूचना कैसे बनाएं
नीचे मैं इसे पसंद को अनुकूलित चाहते हैं एक आइकन, शीर्षक और संदेश है इस
मैं कैसे इस
अधिसूचना विचार
सामान्य देखें:
आपके मामले में, तुम सिर्फ एक कोशिश अधिसूचना में बड़ी तस्वीर प्रदर्शित करने के लिए, दे Notification.BigPictureStyle चाहते एक क्षेत्र जो 64 डीपी लंबा है। यहां तक कि यदि आप एक बड़ी दृश्य शैली के साथ अधिसूचना बनाते हैं, तो यह विस्तारित होने तक सामान्य दृश्य में दिखाई देगा।
Content title
Large icon
Content text
Content info
Small icon
Notification time
सामान्य दृश्य की तरह
बिग देखें - एक अधिसूचना की बड़ी दृश्य दिखाई देता है केवल जब अधिसूचना का विस्तार किया गया है, जो होता है, जब अधिसूचना अधिसूचना दराज के शीर्ष पर है या जब उपयोगकर्ता एक इशारा के साथ अधिसूचना फैलता है। विस्तृत सूचनाएं पहली बार Android 4.1 JellyBean [API 16]
में पेश की गई थीं। Expandable notifications
को Notification.Style
नामक समृद्ध अधिसूचना शैली ऑब्जेक्ट्स का समर्थन करने के लिए डिज़ाइन किया गया था। इस लिंक expandable-notifications-android
आधिकारिक docs
चेक वहाँ कस्टम लेआउट होने की जरूरत है क्या होगा अगर? – IteratioN7T
प्राप्त कर सकते हैं Expanded layouts कहा जाता है कि जो जेली बीन संस्करण से सीधे उपलब्ध है।
सूचनाएं की 2 बार देखा गया हैं:
एक सूचना की बड़ी दृश्य दिखाई देता है केवल जब अधिसूचना का विस्तार किया गया है, जो होता है जब अधिसूचना पर है अधिसूचना दराज के शीर्ष, या जब उपयोगकर्ता एक इशारा के साथ अधिसूचना का विस्तार करता है। विस्तृत सूचनाएं पहली बार एंड्रॉइड 4.1 जेलीबीन [एपीआई 16] में पेश की गई थीं। - सामान्य ध्यान में रखते हुए एक अधिसूचना में प्रकट होता है
Bitmap remote_picture = null;
// Create the style object with BigPictureStyle subclass.
NotificationCompat.BigPictureStyle notiStyle = new
NotificationCompat.BigPictureStyle();
notiStyle.setBigContentTitle("Big Picture Expanded");
notiStyle.setSummaryText("Nice big picture.");
try {
remote_picture = BitmapFactory.decodeStream(
(InputStream) new URL(sample_url).getContent());
} catch (IOException e) {
e.printStackTrace();
}
// Add the big picture to the style.
notiStyle.bigPicture(remote_picture);
पर अधिक जानकारी आपको लगता है कि जरूरत remoteview NotificationCompat उपयोग कर सकते हैं करने के लिए
बिग देखें जैसा
जाओ।नीचे मैं सेट अपने कस्टम लेआउट
activity_downlaodactivity
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
RemoteViews contentView = new RemoteViews(getPackageName(),R.layout.activity_downlaodactivity);
android.support.v4.app.NotificationCompat.Builder mBuilder =
new android.support.v4.app.NotificationCompat.Builder(this)
.setContent(contentView)
manager.notify(0, mBuilder.build());
मैं निम्नलिखित http://developer.android.com/wear/notifications/creating.html
के लिए सूचना बनाएं कोड जोड़ें usingby अधिसूचना बनवाने के नाम पर रखा गया।
// Specify the 'big view' content to display the long
// event description that may not fit the normal content text.
BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
bigStyle.bigText(eventDescription);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setLargeIcon(BitmapFractory.decodeResource(
getResources(), R.drawable.notif_background))
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent)
.setStyle(bigStyle);
यहाँ http://codeversed.com/expandable-notifications-android/ – upenpat