未验证 提交 9261fe12 编写于 作者: O openharmony_ci 提交者: Gitee

!14315 monthly1018:window开发指南使用最新的接口:需同步翻译

Merge pull request !14315 from 葛亚芳/monthly_20221018
......@@ -66,9 +66,9 @@
通过`loadContent`接口加载主窗口的目标页面。
```ts
import Ability from '@ohos.application.Ability'
import UIAbility from '@ohos.app.ability.UIAbility';
class MainAbility extends Ability {
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
// 1.获取应用主窗口。
let windowClass = null;
......@@ -122,11 +122,11 @@ class MainAbility extends Ability {
当不再需要某些子窗口时,可根据具体实现逻辑,使用`destroyWindow`接口销毁子窗口。
```ts
import Ability from '@ohos.application.Ability'
import UIAbility from '@ohos.app.ability.UIAbility';
let windowStage_ = null;
let sub_windowClass = null;
class MainAbility extends Ability {
export default class EntryAbility extends UIAbility {
showSubWindow() {
// 1.创建应用子窗口。
windowStage_.createSubWindow("mySubWindow", (err, data) => {
......@@ -213,9 +213,9 @@ class MainAbility extends Ability {
通过`loadContent`接口加载沉浸式窗口的具体内容。
```ts
import Ability from '@ohos.application.Ability'
import UIAbility from '@ohos.app.ability.UIAbility';
class MainAbility extends Ability {
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
// 1.获取应用主窗口。
let windowClass = null;
......@@ -295,7 +295,7 @@ class MainAbility extends Ability {
"name" : "ohos.permission.SYSTEM_FLOAT_WINDOW",
"usedScene": {
"abilities": [
"MainAbility"
"EntryAbility"
],
"when":"inuse"
}
......@@ -319,11 +319,11 @@ class MainAbility extends Ability {
当不再需要悬浮窗时,可根据具体实现逻辑,使用`destroyWindow`接口销毁悬浮窗。
```ts
import Ability from '@ohos.application.Ability'
import ExtensionContext from '@ohos.application.ServiceExtensionAbility';
import UIAbility from '@ohos.app.ability.UIAbility';
import ExtensionContext from '@ohos.app.ability.ServiceExtensionAbility';
import window from '@ohos.window';
class MainAbility extends Ability {
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
// 2. 创建悬浮窗。
let windowClass = null;
......
......@@ -58,12 +58,11 @@
当不再需要音量条窗口时,可根据具体实现逻辑,使用`hide`接口或`destroyWindow`接口对其进行隐藏或销毁。
```ts
import ExtensionContext from '@ohos.application.ServiceExtensionAbility';
import ExtensionContext from '@ohos.app.ability.ServiceExtensionAbility';
import window from '@ohos.window';
export default class ServiceExtensionAbility1 extends ExtensionContext {
onCreate(want) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
// 1.创建音量条窗口。
let windowClass = null;
......@@ -151,7 +150,6 @@ import window from '@ohos.window';
export default class ServiceExtensionAbility1 extends ExtensionContext {
onCreate(want) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
// 创建音量条窗口。
let windowClass = null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册