Notification is a common component that helps to pop-up a notification window with a content view.

A Notification can contain text and can be created using property.


Create with property

To create a notification using property, follow these steps:

  1. Create notification using the default constructor:

    View view = new View();
    // Sets notification background color.
    view.Size2D = new Size2D(720, 100);
    view.Position = new Position(0, 0, 0);
    view.BackgroundColor = new Color(0, 255, 0, 1.0f);
    Notification notification = new Notification(view);
  2. Set the notification property:

    // Sets a user-defined animation to play when dismissing the notification.
    Animation dismissAni = new Animation(3000);
    // Sets a user-defined animation to play when posting the notification.
    Animation postAni = new Animation(3000);
    // Sets a priority level for the specified notification window, includes: None , Base , Medium , High , Top.
    // Need to add the privilege:
    // <privilege></privilege>.
    // Sets position and size of the notification window.
    Rectangle positionSize = new Rectangle(0, 0, 600, 300);
    // Posts a notification window with the content view.
    // Need to add the privilege:
    // <privilege></privilege>.
  3. Set the notification content:

    // Sets text in notification.
    TextLabel text = new TextLabel("This is notification sample.");
    text.HorizontalAlignment = HorizontalAlignment.Center;
    text.VerticalAlignment = VerticalAlignment.Center;
    text.TextColor = Color.Black;
    text.Size2D = new Size2D(720, 100);
    // Adds text label to view.
    // Adds view to the main window.
    // Posts notification for 3000ms.
  • Dependencies
    • Tizen 6.0 and Higher