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

Опубликовано: 15 Май 2026
на канале: Andriod Developer Tips
67
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 Notification Compat. Builder
Step 2:
Call set Style method on the builder object an pass it an instance of Notification Compat. Decorated Custom View Style

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

Step 4:
Call set Custom Content View method on the builder object for setting custom layout for a collapsed notification.
Optionally you can call set Custom Big Content View method for setting alternative layout for an expanded notification. #Andriod_Developer_Tips
Youtube Link: https://bit.ly/2ys3ceY
Facebook Link: http://bit.ly/2C7JSr0
Twitter Link: http://bit.ly/2Cbz9Ml