提交 e35d8816 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 de02c805
master E0523 OpenHarmony-3.2-Beta1 OpenHarmony-3.2-Beta2 OpenHarmony-3.2-Beta3 OpenHarmony-3.2-Beta4 OpenHarmony-3.2-Beta5 OpenHarmony-3.2-Release OpenHarmony-4.0-Beta1 OpenHarmony-4.0-Beta2 OpenHarmony_filemanager_develop_20220505 OpenHarmony_filemanager_develop_20220614 TR4270 bak_OpenHarmony-4.0-Beta1_20230529 docs-modify feature_IDL_20220811 monthly_20220614 monthly_20220816 monthly_20221018 monthly_20230815 revert-merge-17651-master revert-merge-19334-OpenHarmony-4.0-Beta1 revert-merge-19586-master revert-merge-20613-master revert-merge-21757-OpenHarmony-4.0-Beta2 revert-merge-21765-OpenHarmony-4.0-Beta2 revert-merge-23766-master revert-merge-5580-master weekly_20220406 weekly_20220412 weekly_20220419 weekly_20220426 weekly_20220503 weekly_20220510 weekly_20220524 weekly_20220531 weekly_20220607 weekly_20220614 weekly_20220621 weekly_20220628 weekly_20220705 weekly_20220712 weekly_20220719 weekly_20220726 weekly_20220802 weekly_20220809 weekly_20220816 weekly_20220823 weekly_20220830 weekly_20220906 weekly_20220913 weekly_20220920 weekly_20220927 weekly_20221004 weekly_20221011 weekly_20221018 weekly_20221025 weekly_20221101 weekly_20221108 weekly_20221115 weekly_20221122 weekly_20221129 weekly_20221206 weekly_20221213 weekly_20221220 weekly_20221227 weekly_20230103 weekly_20230110 weekly_20230117 weekly_20230124 weekly_20230131 weekly_20230207 weekly_20230214 weekly_20230221 weekly_20230228 weekly_20230307 weekly_20230314 weekly_20230321 weekly_20230328 weekly_20230404 weekly_20230411 weekly_20230418 weekly_20230425 weekly_20230502 weekly_20230509 weekly_20230516 weekly_20230523 weekly_20230530 weekly_20230606 weekly_20230613 weekly_20230619 weekly_20230626 weekly_20230627 weekly_20230704 weekly_20230712 weekly_20230725 weekly_20230801 weekly_20230808 weekly_20230815 weekly_20230822 weekly_20230829 weekly_20230905 OpenHarmony-v4.0-Beta2 OpenHarmony-v4.0-Beta1 OpenHarmony-v3.2.3-Release OpenHarmony-v3.2.2-Release OpenHarmony-v3.2.1-Release OpenHarmony-v3.2-Release OpenHarmony-v3.2-Beta5 OpenHarmony-v3.2-Beta4 OpenHarmony-v3.2-Beta3 OpenHarmony-v3.2-Beta2 OpenHarmony-v3.2-Beta1
无相关合并请求
# Window Development
# 窗口开发指导
## When to Use
The interface layer of the window runs in the application process. It loads the page layout and provides APIs.
By calling these APIs, you can create and destroy a window, set the position and size of a window, and enter the immersive mode (full-screen mode).
## 场景介绍
窗口的接口层在应用进程运行,负责对页面布局的加载,和提供应用程序接口。
通过调用窗口接口可以实现窗口创建与销毁,窗口的位置、大小布局,以及进入沉浸式等。
## Available APIs
For details about the APIs, see [Window](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-window.md).
## 接口说明
窗口开放的能力如下:Window类,具体的API详见[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-window.md)
**Table 1** Main window APIs
**表1** 窗口主要接口API
| API | Description |
| 接口名 | 描述 |
| :----------------------------------------------------------- | :--------------------------------------------- |
| create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void | Creates a subwindow. |
| moveTo(x: number, y: number): Promise\<void> | Moves the window position. A positive value of **x** indicates that the window moves to the right, and a positive value of **y** indicates that the window moves downwards.|
| resetSize(width: number, height: number): Promise\<void> | Changes the window size. |
| hide(): Promise\<void> | Hides the window. |
| destroy(): Promise\<void> | Destroys the window. |
| create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void | 创建子窗口。 |
| moveTo(x: number, y: number): Promise\<void> | 移动窗口位置,x值为正表示右移,y为正表示下移。 |
| resetSize(width: number, height: number): Promise\<void> | 改变当前窗口大小。 |
| hide(): Promise\<void> | 隐藏当前窗口。 |
| destroy(): Promise\<void> | 销毁当前窗口。 |
## How to Develop
## 开发步骤
### Creating a Main Window
### 创建主窗口
Currently, the main window is automatically created when the application is started. The declaration period, hiding, and destruction of the main window are managed by the application.
### Creating a Subwindow
You can call **create** to create a subwindow. The sample code is as follows:
在当前模型下,应用启动时会自动创建主窗口,由应用管理窗口的声明周期,隐藏及销毁由应用管理。
### 创建子窗口
当前可以通过`create`接口创建子窗口。具体示例代码如下:
```
import window from '@ohos.window';
......@@ -37,9 +37,9 @@ You can call **create** to create a subwindow. The sample code is as follows:
});
```
### Obtaining a Window Object
### 获取窗口对象
- Call **getTopWindow** to obtain the top window of the application. The sample code is as follows:
- 应用内可以通过`getTopWindow`来获取当前应用内最后显示的窗口。具体示例代码如下:
```
var windowClass = null;
......@@ -52,7 +52,7 @@ You can call **create** to create a subwindow. The sample code is as follows:
})
```
- You can also call **find** to obtain created subwindows in the application. The sample code is as follows:
- 应用内也可以通过`Find`来获取已经创建的子窗口。具体示例代码如下:
```
var windowClass = null;
......@@ -65,9 +65,9 @@ You can call **create** to create a subwindow. The sample code is as follows:
});
```
### Hiding and Destroying a Window
### 窗口的隐藏和销毁
After a window object is obtained, you can call **hide** and **destroy** to hide and destroy the window object, respectively. The sample code is as follows:
在已经获取到窗口对象的前提下,可以调用`hide``destroy`来隐藏和销毁已经创建的窗口对象。具体示例代码如下:
```
let promise = windowClass.hide();
......@@ -85,11 +85,11 @@ After a window object is obtained, you can call **hide** and **destroy** to hide
})
```
### Enabling the Full-Screen Mode
### 设置沉浸式窗口
After a window object is obtained, you can call **setFullScreen** to enable the full-screen mode for the window.
在已经获取到应用窗口对象的前提下,调用`setFullScreen`来设置窗口进入全屏沉浸式。
The sample code is as follows:
示例代码如下:
```
import window from '@ohos.window';
......@@ -101,4 +101,5 @@ try {
}
```
For the complete code, see [immersive](https://gitee.com/openharmony/windowmanager/tree/master/AppDemo/window/immersive).
完整[示例工程](https://gitee.com/openharmony/windowmanager/tree/master/AppDemo/window/immersive)
# Window Overview
# 窗口开发概述
The Window Manager subsystem provides basic capabilities of window and display management. It is the basis for UI display.
The Window Manager subsystem enables multiple applications to use the same physical screen for display and interaction. For each application, you need to design the interaction interface in the fixed window area. A window acts as a display container of the application interface, and the Window Manager subsystem organizes the interaction interfaces into a form visible to end users.
**窗口子系统**提供窗口管理和Display管理的基础能力,是系统图形界面显示所需的基础子系统。
窗口系统的作用,是提供一种机制,让多个应用界面复用同一块物理屏幕进行显示和交互。每个应用程序中,需要实现固定窗口区域内的交互界面设计,窗口作用应用界面的显示容器,而窗口系统负责将这些交互界面组织成最终用户见到的形态。
## Basic Concepts
## 基本概念
** Immersive**: The colors of the application interface, status bar, and navigation bar are the same to achieve the visual integrity.
**沉浸式**:应用窗口跟状态栏与导航栏颜色一致,视觉上融合。
## Working Principles
## 运作机制
To display a UI on a screen, the application and system need to request a window object from the Window Manager subsystem. This object generally represents a rectangular area on the screen and has attributes such as the position, width, height, and overlay layer. The object also loads the root node of the UI framework in the interface. The UI of the application is loaded and displayed in the window through the root node.
为了将图形界面显示在屏幕上,应用和系统需要向窗口系统申请窗口对象,这通常代表了屏幕上一块矩形区域,具有位置、宽高、和叠加层次等属性。同时,窗口对象也负责加载界面中UI框架的根节点,应用程序的UI界面就通过这个根节点在窗口中加载显示。
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部