harmony 鸿蒙Interfaces (Others)
Interfaces (Others)
NOTE
The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Configuration9+
Describes the parameters for creating a child window or system window.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.WindowManager.WindowManager.Core
|Name|Type|Mandatory|Description |
|———-|————————–|–|—————————————————————————–|
|name |string |Yes|Name of the window. |
|windowType|WindowType|Yes|Window type. |
|ctx |BaseContext|No|Current application context. If no value is passed, no context is used.
In the FA model, do not pass in this parameter when creating a child window. Otherwise, an error is reported.
In the stage model, you must pass in this parameter when creating a floating window, modal window, or system window.|
|displayId|number |No|ID of the current physical screen. If no value is passed, the default value -1 is used. The value must be an integer. |
|parentId |number |No|ID of the parent window. If no value is passed, the default value -1 is used. The value must be an integer. |
|decorEnabled12+|boolean|No|Whether the window decoration is enabled. This parameter is valid only when windowType is set to TYPE_DIALOG. The value true means that the window decoration is enabled, and false means the opposite. The default value is false.
System capability: SystemCapability.Window.SessionManager|
|title12+|string|No|Title of the window when decorEnabled is set to true. The title display area should not go past the left side of the three-button area of the system. Any part that goes beyond will show as an ellipsis. If this parameter is not set, an empty string is used.
System capability: SystemCapability.Window.SessionManager|
|defaultDensityEnabled20+|boolean|No|Whether the window should use the default density of the system. If the default density is used, the window does not change layout when the system display size changes.
If this parameter is set to true for a system window, the window uses the default density and is not affected by setDefaultDensityEnabled() or setCustomDensity() settings for the main window.
If this parameter is set to false, the window does not use the default density and is affected by those settings.
The default value is false.
System capability: SystemCapability.Window.SessionManager|
SystemBarProperties
Describes the properties of the status bar and three-button navigation bar. It is used to set the window-level status bar and three-button navigation bar properties.
Atomic service API: This API can be used in atomic services since API version 12.
Name | Type | Mandatory | Description |
---|---|---|---|
statusBarColor | string | No | Background color of the status bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, ’#00FF00’ or ’#FF00FF00’. The default value is ’#66000000’. System capability: SystemCapability.WindowManager.WindowManager.Core |
isStatusBarLightIcon7+ | boolean | No | Whether any icon on the status bar is highlighted. The value true means that the icon is highlighted, and false means the opposite. The default value is false. System capability: SystemCapability.WindowManager.WindowManager.Core |
statusBarContentColor8+ | string | No | Color of the text on the status bar. After this property is set, the setting of isStatusBarLightIcon is invalid. The default value is ’#E5FFFFFF’. System capability: SystemCapability.WindowManager.WindowManager.Core |
navigationBarColor | string | No | Background color of the three-button navigation bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, ’#00FF00’ or ’#FF00FF00’. The default value is ’#66000000’. System capability: SystemCapability.WindowManager.WindowManager.Core |
isNavigationBarLightIcon7+ | boolean | No | Whether any icon on the three-button navigation bar is highlighted. The value true means that the icon is highlighted, and false means the opposite. The default value is false. System capability: SystemCapability.WindowManager.WindowManager.Core |
navigationBarContentColor8+ | string | No | Color of the text on the three-button navigation bar. After this property is set, the setting of isNavigationBarLightIcon is invalid. The default value is ’#E5FFFFFF’. System capability: SystemCapability.WindowManager.WindowManager.Core |
enableStatusBarAnimation12+ | boolean | No | Whether to enable animation for a status bar property change. The value true means to enable animation, and false means the opposite. The default value is false. System capability: SystemCapability.Window.SessionManager |
enableNavigationBarAnimation12+ | boolean | No | Whether to enable animation for a three-button navigation bar property change. The value true means to enable animation, and false means the opposite. The default value is false. System capability: SystemCapability.Window.SessionManager |
StatusBarProperty18+
Describes the properties of the status bar. These properties are returned when you query the status bar’s configuration details.
Atomic service API: This API can be used in atomic services since API version 18.
Name | Type | Mandatory | Description |
---|---|---|---|
contentColor | string | Yes | Color of the text on the status bar. The value is in ARGB format, for example, #E5FFFFFF. System capability: SystemCapability.Window.SessionManager |
SystemBarStyle12+
Describes the properties of the status bar. These properties are valid for the page-level status bar.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.WindowManager.WindowManager.Core
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
statusBarContentColor | string | Yes | Yes | Color of the text on the status bar. The default value is ’#E5FFFFFF’. |
Rect7+
Describes the rectangular area of the window.
System capability: SystemCapability.WindowManager.WindowManager.Core
Atomic service API: This API can be used in atomic services since API version 11.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
left | number | Yes | Yes | Left boundary of the rectangle, in px. The value must be an integer. |
top | number | Yes | Yes | Top boundary of the rectangle, in px. The value must be an integer. |
width | number | Yes | Yes | Width of the rectangle, in px. The value must be an integer. |
height | number | Yes | Yes | Height of the rectangle, in px. The value must be an integer. |
AvoidArea7+
Describes the area where the window cannot be displayed, for example, the system bar area, notch, gesture area, and soft keyboard area. Touch events will not be responded in this area.
Pay attention to the following restrictions on this area:
The bottom gesture area, apart from the bottom navigation bar area, supports transparent transmission of touch events, and touch and hold events, but not drag events.
The gesture area on the left and right sides supports transparent transmission of touch events, touch and hold events, and swipe up and down events, but not drag events.
The bottom navigation bar area supports responding to touch events, touch and hold events, and drag events. However, it does not support transparent transmission of events.
System capability: SystemCapability.WindowManager.WindowManager.Core
Atomic service API: This API can be used in atomic services since API version 11.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
visible9+ | boolean | Yes | Yes | Whether the window can be displayed in the area. The value true means that the window can be displayed in the area, and false means the opposite. |
leftRect | Rect | Yes | Yes | Rectangle on the left of the screen. |
topRect | Rect | Yes | Yes | Rectangle at the top of the screen. |
rightRect | Rect | Yes | Yes | Rectangle on the right of the screen. |
bottomRect | Rect | Yes | Yes | Rectangle at the bottom of the screen. |
Size7+
Describes the window size.
System capability: SystemCapability.WindowManager.WindowManager.Core
Atomic service API: This API can be used in atomic services since API version 11.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
width | number | Yes | Yes | Window width, in px. The value must be an integer. |
height | number | Yes | Yes | Window height, in px. The value must be an integer. |
RectChangeOptions12+
Describes the value and reason returned upon a window rectangle (position and size) change.
System capability: SystemCapability.Window.SessionManager
Atomic service API: This API can be used in atomic services since API version 12.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
rect | Rect | Yes | Yes | New value of the window rectangle. |
reason | RectChangeReason | Yes | Yes | Reason for the window rectangle change. |
AvoidAreaOptions12+
Describes the new area where the window cannot be displayed. The new area is returned when the corresponding event is triggered.
System capability: SystemCapability.WindowManager.WindowManager.Core
Atomic service API: This API can be used in atomic services since API version 12.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
type | AvoidAreaType | Yes | Yes | Type of the new area returned. |
area | AvoidArea | Yes | Yes | New area returned. |
WindowProperties
Describes the window properties.
System capability: SystemCapability.WindowManager.WindowManager.Core
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
windowRect7+ | Rect | No | No | Window size, which can be obtained from the page lifecycle onPageShow or the application lifecycle onForeground. Atomic service API: This API can be used in atomic services since API version 11. |
drawableRect11+ | Rect | No | No | Size of the rectangle that can be drawn in the window. The upper boundary and left boundary are calculated relative to the window. In the stage model, this API must be used after loadContent() or setUIContent() is called to load the page content. Atomic service API: This API can be used in atomic services since API version 12. |
type7+ | WindowType | No | No | Window type. Atomic service API: This API can be used in atomic services since API version 12. |
isFullScreen | boolean | No | No | Whether the window is displayed in full-screen mode. The default value is false. The value true means that the window is displayed in full-screen mode, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
isLayoutFullScreen7+ | boolean | No | No | Whether the window is immersive and in full-screen mode (not in floating window or split-screen scenarios). The default value is false. The value true means that the window is immersive and in full-screen mode, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
focusable7+ | boolean | Yes | No | Whether the window can gain focus. The default value is true. The value true means that the window can gain focus, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
touchable7+ | boolean | Yes | No | Whether the window is touchable. The default value is true. The value true means that the window is touchable, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
brightness | number | No | No | Screen brightness. The value is a floating point number in the range [0.0, 1.0], and the value 1.0 means the brightest. If no value is passed, the brightness follows the system. In this case, the obtained brightness value is -1. Atomic service API: This API can be used in atomic services since API version 11. |
dimBehindValue(deprecated) | number | No | No | Dimness of the window that is not on top. The value is a floating point number in the range [0.0, 1.0], and the value 1.0 means the dimmest. NOTE This property is supported since API version 7 and deprecated since API version 9. Currently, no substitute is available. |
isKeepScreenOn | boolean | No | No | Whether the screen is always on. The default value is false. The value true means that the screen is always on, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 11. |
isPrivacyMode7+ | boolean | No | No | Whether the window is in privacy mode. The default value is false. The value true means that the window is in privacy mode, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
isRoundCorner(deprecated) | boolean | No | No | Whether the window has rounded corners. The default value is false. The value true means that the window has rounded corners, and false means the opposite. NOTE This property is supported since API version 7 and deprecated since API version 9. Currently, no substitute is available. |
isTransparent7+ | boolean | No | No | Whether the window background is transparent. The default value is false. The value true means that the window background is transparent, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
id9+ | number | Yes | No | Window ID. The default value is 0. The value must be an integer. Atomic service API: This API can be used in atomic services since API version 12. |
displayId12+ | number | Yes | Yes | ID of the screen where the window is located. By default, the ID of the main screen is returned. The value must be an integer. Atomic service API: This API can be used in atomic services since API version 12. |
name18+ | string | Yes | Yes | Window name. The default value is an empty string. Atomic service API: This API can be used in atomic services since API version 18. |
DecorButtonStyle14+
Describes the button style of the system decoration bar.
System capability: SystemCapability.Window.SessionManager
Atomic service API: This API can be used in atomic services since API version 14.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
colorMode | ConfigurationConstant.ColorMode | Yes | Yes | Color mode. Buttons automatically adapt to light colors in dark mode and to dark colors in light mode. If this parameter is not set, they will automatically match the system color mode. |
buttonBackgroundSize | number | Yes | Yes | Size of the button when it is highlighted. The value ranges from 20 vp to 40 vp. The default value is 28 vp. |
spacingBetweenButtons | number | Yes | Yes | Spacing between buttons. The value ranges from 8 vp to 24 vp. The default value is 12 vp. |
closeButtonRightMargin | number | Yes | Yes | Margin between the rightmost edge of the close button and the window. The value ranges from 6 vp to 22 vp. The default value is 20 vp. |
buttonIconSize20+ | number | Yes | Yes | Size of the button icon. The value ranges from 16 vp to 24 vp. The default value is 20 vp. |
buttonBackgroundCornerRadius20+ | number | Yes | Yes | Radius of the button background rounded corner. The value ranges from 4 vp to 8 vp. The default value is 4 vp. |
WindowLimits11+
Describes the window size limits. You can call setWindowLimits to set the window size limits and call getWindowLimits to obtain the current window size limits.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Window.SessionManager
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
maxWidth | number | Yes | Yes | Maximum window width, in px. The value must be an integer. The default value is 0, indicating that the property does not change. The lower limit is 0, and the upper limit is the maximum width specified by the system. |
maxHeight | number | Yes | Yes | Maximum window height, in px. The value must be an integer. The default value is 0, indicating that the property does not change. The lower limit is 0, and the upper limit is the maximum height specified by the system. |
minWidth | number | Yes | Yes | Minimum window width, in px. The value must be an integer. The default value is 0, indicating that the property does not change. The lower limit is 0, and the upper limit is the minimum width specified by the system. |
minHeight | number | Yes | Yes | Minimum window height, in px. The value must be an integer. The default value is 0, indicating that the property does not change. The lower limit is 0, and the upper limit is the minimum height specified by the system. |
TitleButtonRect11+
Describes the rectangle used to hold the minimize, maximize, and close buttons on the title bar. This rectangle is located in the upper right corner of the window.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Window.SessionManager
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
right | number | Yes | Yes | Right boundary of the rectangle, in vp. The value must be an integer. |
top | number | Yes | Yes | Top boundary of the rectangle, in vp. The value must be an integer. |
width | number | Yes | Yes | Width of the rectangle, in vp. The value must be an integer. |
height | number | Yes | Yes | Height of the rectangle, in vp. The value must be an integer. |
MoveConfiguration15+
Describes the window movement configuration.
Atomic service API: This API can be used in atomic services since API version 15.
System capability: SystemCapability.Window.SessionManager
Name | Type | Mandatory | Description |
---|---|---|---|
displayId | number | No | Target display ID. The value must be an integer. If a non-integer is passed in, the value is rounded down. If this parameter is passed in, the window is positioned relative to the upper left corner of the target display. If this parameter is left empty or the target display ID does not exist, the window is positioned relative to the upper left corner of the current display. |
WindowDensityInfo15+
Describes the information about the display density of the screen where the window is located and the window’s custom display density. It is a scale factor independent of pixel units, that is, a factor for scaling display size.
Atomic service API: This API can be used in atomic services since API version 15.
System capability: SystemCapability.Window.SessionManager
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
systemDensity | number | Yes | No | System’s display size scale factor for the screen where the window is located. The value ranges from 0.5 to 4.0 and varies according to user settings. |
defaultDensity | number | Yes | No | Default display size scale factor for the screen where the window is located. The value ranges from 0.5 to 4.0 and varies with the screen. |
customDensity | number | Yes | No | Custom display size scale factor of the window. The value ranges from 0.5 to 4.0. If this parameter is left unspecified, the system’s display size scale factor is used. |
WindowLayoutInfo15+
Describes the information about the window layout.
Atomic service API: This API can be used in atomic services since API version 15.
System capability: SystemCapability.Window.SessionManager
Name | Type | Mandatory | Description |
---|---|---|---|
windowRect15+ | Rect | Yes | Window rectangle, that is, the position and size of the window on the display. |
KeyboardInfo18+
Describes the information about the soft keyboard window.
Atomic service API: This API can be used in atomic services since API version 18.
System capability: SystemCapability.Window.SessionManager
Name | Type | Mandatory | Description |
---|---|---|---|
beginRect | Rect | Yes | Position and size of the soft keyboard before the animation starts. |
endRect | Rect | Yes | Position and size of the soft keyboard before the animation ends. |
animated20+ | boolean | No | Whether there is a show/hide animation. The value true means that there is a show/hide animation, and false means the opposite. |
config20+ | WindowAnimationConfig | No | Animation configuration. |
ShowWindowOptions20+
Describes the parameters for displaying a child window or system window.
System capability: SystemCapability.Window.SessionManager
Atomic service API: This API can be used in atomic services since API version 20.
Name | Type | Mandatory | Description |
---|---|---|---|
focusOnShow | boolean | No | Whether the window automatically gains focus when showWindow() is called. The default is true. This parameter does not take effect for the main window, modal window, and dialog boxes. |
WindowAnimationConfig20+
Describes the configuration for window animation.
Atomic service API: This API can be used in atomic services since API version 20.
System capability: SystemCapability.Window.SessionManager
Name | Type | Mandatory | Description |
---|---|---|---|
curve | WindowAnimationCurve | Yes | Type of animation curve. |
duration | number | No | Duration for playing the animation, in milliseconds (ms). The default value is 0, and the maximum value is 3000. Whether it is required depends on the animation curve type. |
param | WindowAnimationCurveParam | No | Parameters for the animation curve. Whether it is required depends on the animation curve type. |
WindowInfo18+
Describes the window information.
System capability: SystemCapability.Window.SessionManager
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
rect | Rect | Yes | No | Window size. |
bundleName | string | Yes | No | Bundle name of the application. |
abilityName | string | Yes | No | Ability name. |
windowId | number | Yes | No | Window ID. |
windowStatusType | WindowStatusType | Yes | No | Window mode. |
isFocused | boolean | Yes | Yes | Whether the window gains focus. The value true means that the window gains focus, and false means the opposite. |
TransitionAnimation20+
Describes the window transition animation.
Atomic service API: This API can be used in atomic services since API version 20.
System capability: SystemCapability.Window.SessionManager
Name | Type | Mandatory | Description |
---|---|---|---|
config | WindowAnimationConfig | Yes | Transition animation configuration. |
opacity | number | No | Opacity of the window during the transition animation. If this parameter is set to 0, the window is completely transparent. When the animation type is WindowTransitionType.DESTROY, this represents the opacity at the end of the animation. The value ranges from 0 to 1. The value is reset to 1 when the animation ends. |
Callback15+
(data: T)15+
(data: T): V;
Describes a generic callback function.
You can set data to customize the parameter type of the information returned by the callback.
Atomic service API: This API can be used in atomic services since API version 15.
System capability: SystemCapability.Window.SessionManager
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
data | T | Yes | Parameter of type T that needs to be passed when the callback function is called. |
Return value
Type | Description |
---|---|
V | Value of type V. |
RotationChangeInfo19+
Describes the window information obtained during window rotation changes.
Atomic service API: This API can be used in atomic services since API version 19.
System capability: SystemCapability.Window.SessionManager
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
type | RotationChangeType | No | No | Type of window rotation event. |
orientation | number | No | No | Display orientation of the window. - 0: portrait. - 1: reverse landscape. - 2: reverse portrait. - 3: landscape. Note that the orientation here is different from the orientation property of the display object. |
displayId | number | No | No | ID of the screen where the window is located. |
displayRect | Rect | No | No | Size of the rectangle after the screen where the window is located is rotated. |
RotationChangeResult19+
Describes the information returned by the application during window rotation changes.
The system uses the information to adjust the size of the current window rectangle. If the returned information is about the rotation change of the main window, the system does not change the size of the main window.
There are limitations on the size of application windows and system windows. For details about specific restrictions and rules, see resize.
Atomic service API: This API can be used in atomic services since API version 19.
System capability: SystemCapability.Window.SessionManager
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
rectType | RectType | No | No | Type of window rectangle coordinate system. |
windowRect | Rect | No | No | Information about the window’s rectangle relative to the screen or parent window coordinate system. |
RotationChangeCallback19+
(info: T)19+
(info: T): U;
Describes a generic callback function for rotation event notifications.
In this callback function, the parameter type is RotationChangeInfo, and the return value type is RotationChangeResult|void.
Atomic service API: This API can be used in atomic services since API version 19.
System capability: SystemCapability.Window.SessionManager
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
info | T | Yes | Parameter of type RotationChangeInfo passed by the system when the callback function is called. |
Return value
Type | Description |
---|---|
U | Value of type RotationChangeResult|void. |
SubWindowOptions11+
Describes the parameters used for creating a child window.
System capability: SystemCapability.Window.SessionManager
Name | Type | Read-Only | Optional | Description |
---|---|---|---|---|
title11+ | string | No | No | Title of the child window. The title display area should not go past the left side of the three-button area of the system. Any part that goes beyond will show as an ellipsis. Atomic service API: This API can be used in atomic services since API version 12. |
decorEnabled11+ | boolean | No | No | Whether decorations are displayed in the child window. The value true means that decorations are displayed, and false means the opposite. Atomic service API: This API can be used in atomic services since API version 12. |
isModal12+ | boolean | No | Yes | Whether the modal property is enabled for the child window. The value** true** means that the modal property is enabled for the child window, and false means to disable it. The default value is false. Atomic service API: This API can be used in atomic services since API version 12. |
modalityType14+ | ModalityType | No | Yes | Modality type of the child window. This parameter takes effect only when the modal property is enabled for the child window. WINDOW_MODALITY means window-modal, and APPLICATION_MODALITY means application-modal. The default value is WINDOW_MODALITY. Atomic service API: This API can be used in atomic services since API version 14. |
windowRect18+ | Rect | No | Yes | Rectangle of the child window, and the size of the child window is limited. For details, see resize(). If this parameter is not specified, the window is displayed in full screen by default. Atomic service API: This API can be used in atomic services since API version 18. |
zLevel18+ | number | No | Yes | Z-level of the child window. This parameter is valid only when the modal property is not enabled for the child window, that is, isModal is not set. The value is an integer in the range [-10000, 10000]. Floating-point numbers will be rounded down. The default value is 0. Atomic service API: This API can be used in atomic services since API version 18. |
maximizeSupported19+ | boolean | No | Yes | Whether the child window supports maximization. This API can be used only on 2-in-1 devices. The value true means that the child window supports maximization, and false means the opposite. The default value is false. Atomic service API: This API can be used in atomic services since API version 19. |
outlineEnabled20+ | boolean | No | Yes | Whether the child window displays an outline. This API can be used only on 2-in-1 devices. The value true means that the child window displays an outline, and false means the opposite. The default value is false. Atomic service API: This API can be used in atomic services since API version 20. |
你可能感兴趣的鸿蒙文章
harmony 鸿蒙ARKUI_TextPickerCascadeRangeContent
harmony 鸿蒙ARKUI_TextPickerRangeContent
harmony 鸿蒙ArkUI_AnimateCompleteCallback
harmony 鸿蒙ArkUI_ContextCallback
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦