uiability-overview.md 2.3 KB
Newer Older
G
Gloria 已提交
1 2 3 4 5
# UIAbility Component Overview


## Overview

6
UIAbility is a type of application component that provides the UI for user interaction.
G
Gloria 已提交
7

G
Gloria 已提交
8 9 10 11 12 13
The following design philosophy is behind UIAbility:

1. Native support for [cross-device migration](hop-cross-device-migration.md) and [multi-device collaboration](hop-multi-device-collaboration.md) at the application component level

2. Support for multiple device types and window forms

14
For details, see [Interpretation of the Application Model] (application-model-description.md).
G
Gloria 已提交
15 16 17 18

The UIAbility division principles and suggestions are as follows:

UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. An application can contain one or more UIAbility components. For example, for a payment application, you can use two UIAbility components to carry the entry and payment functionalities.
19 20

Each UIAbility component instance is displayed as a mission in Recents.
G
Gloria 已提交
21

G
Gloria 已提交
22 23 24 25 26
You can develop a single UIAbility or multiple UIAbilities for your application based on service requirements.

- If you want only one mission to be displayed in Recents, use one UIAbility and multiple pages.

- If you want multiple missions to be displayed in Recents or multiple windows to be opened simultaneously, use multiple UIAbilities.
G
Gloria 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39

## Privacy Statement Configuration

To enable an application to properly use a UIAbility component, declare the UIAbility name, entry, and tags under [abilities](../quick-start/module-configuration-file.md#abilities) in the [module.json5 configuration file](../quick-start/module-configuration-file.md).


```json
{
  "module": {
    // ...
    "abilities": [
      {
        "name": "EntryAbility", // Name of the UIAbility component.
40
        "srcEntry": "./ets/entryability/EntryAbility.ts", // Code path of the UIAbility component.
G
Gloria 已提交
41 42 43 44 45 46 47 48 49 50 51
        "description": "$string:EntryAbility_desc", // Description of the UIAbility component.
        "icon": "$media:icon", // Icon of the UIAbility component.
        "label": "$string:EntryAbility_label", // Label of the UIAbility component.
        "startWindowIcon": "$media:icon", // Index of the icon resource file.
        "startWindowBackground": "$color:start_window_background", // Index of the background color resource file.
        // ...
      }
    ]
  }
}
```