UIAbility組件概述

2024-01-25 12:13 更新

概述

UIAbility組件是一種包含UI界面的應用組件,主要用于和用戶交互。

UIAbility組件是系統(tǒng)調度的基本單元,為應用提供繪制界面的窗口;一個UIAbility組件中可以通過多個頁面來實現(xiàn)一個功能模塊。每一個UIAbility組件實例,都對應于一個最近任務列表中的任務。

聲明配置

為使應用能夠正常使用UIAbility,需要在module.json5配置文件abilities標簽中聲明UIAbility的名稱、入口、標簽等相關信息。

  1. {
  2. "module": {
  3. // ...
  4. "abilities": [
  5. {
  6. "name": "EntryAbility", // UIAbility組件的名稱
  7. "srcEntrance": "./ets/entryability/EntryAbility.ts", // UIAbility組件的代碼路徑
  8. "description": "$string:EntryAbility_desc", // UIAbility組件的描述信息
  9. "icon": "$media:icon", // UIAbility組件的圖標
  10. "label": "$string:EntryAbility_label", // UIAbility組件的標簽
  11. "startWindowIcon": "$media:icon", // UIAbility組件啟動頁面圖標資源文件的索引
  12. "startWindowBackground": "$color:start_window_background", // UIAbility組件啟動頁面背景顏色資源文件的索引
  13. // ...
  14. }
  15. ]
  16. }
  17. }
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號