目录

Window Z-Order

When to Use

Window z-order (ZOrder) refers to the stacking order of multiple windows on the screen, which determines the front-to-back display relationship of windows.

The larger the z-order value, the closer the window is displayed to the front and can cover windows with smaller z-order values. Conversely, windows with smaller z-order values may be obscured by other windows.

For third-party apps, the z-order of a window cannot be directly modified, but the display z-order of subwindows can be indirectly affected by controlling the zLevel attribute.

The system controls the visibility and interaction priority of the user interface by managing ZOrder and zLevel.

This section systematically explains the window z-order management mechanism from five aspects: basic concepts, z-order rules, parent-child window relationships, the TopMost window mechanism, and related API examples.

Basic Concepts and Z-Order Rules

[h2]ZOrder and zLevel

ZOrder represents the window stacking order maintained internally by the system. The larger the value, the closer the window is to the front. Third-party apps cannot directly modify ZOrder.

zLevel represents the relative z-order between subwindows within an app that can be controlled by third-party apps, and is only effective for non-modal subwindows. The value range of zLevel is [-10000, 10000], and the default value is 0. The greater the zLevel value, the larger the corresponding ZOrder, and the closer the window is to the front.

[h2]Z-Order Rules for Window zLevel

[h2]Z-Order Rules for Window Types

[h2]Z-Order Rules for Parent-Child Windows

[h2]Z-Order Rules for TopMost Windows

Z-Order Control Mechanisms

Feature/Operation Control Method Effective Scope Applicable Scenario
Z-order System-managed Effective across apps Internal rendering order management
zLevel setSubWindowZLevel()/Set when creating a window Effective only within the same app z-order management for subwindows
Window topmost setWindowTopmost() Effective across apps Persistent windows such as video and navigation
Raise by click setRaiseByClickEnabled() Between subwindows of the same type within the same application Prevent accidental touches, fixed layout