Up next

Android tutorial (2018) - 51- Notification with Custom Layout

9 Views· 14 Aug 2019
ITCOURSES
ITCOURSES
5 subscribers
0

In this video we are going to learn about how to create an android notification with custom layouts.

For create a custom notification you have to create two separate layout files.
First layout for representing notification in its collapsed form and second layout for representing notification in its expanded form.

Following are the steps for creating custom notification in android app
Step 1:
Build a basic notification with NotificationCompat.Builder
Step 2:
Call setStyle method on the builder object an pass it an instance of NotificationCompat.DecoratedCustomViewStyle

Step 3:
Inflate the two custom layouts as an instance of RemoteViews

Step 4:
Call setCustomContentView method on the builder object for setting custom layout for a collapsed notification.
Optionally you can call setCustomBigContentView method for setting alternative layout for an expanded notification.

Like my Facebook page : https://www.facebook.com/codeglympse
Subscribe My YouTube channel : http://www.youtube.com/ticoontechnologies

Show more
100% online learning from the world's best universities, organisations and Instructors

 0 Comments sort   Sort By


Up next