<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: harmony</title>
    <description>The latest articles on DEV Community by harmony (@loveharmony).</description>
    <link>https://dev.to/loveharmony</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3291238%2Fdcfdac6c-129d-4b0c-a4a3-f02e2c5579fd.png</url>
      <title>DEV Community: harmony</title>
      <link>https://dev.to/loveharmony</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loveharmony"/>
    <language>en</language>
    <item>
      <title>CodeGenie, an AI programming tool in DevEcoStudio</title>
      <dc:creator>harmony</dc:creator>
      <pubDate>Wed, 25 Jun 2025 13:32:19 +0000</pubDate>
      <link>https://dev.to/loveharmony/codegenie-an-ai-programming-tool-in-devecostudio-174n</link>
      <guid>https://dev.to/loveharmony/codegenie-an-ai-programming-tool-in-devecostudio-174n</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article label: Hongmeng Development Tools/CodeGenie&lt;br&gt;
this article DevEcoStudio version number: 5.1.0.828&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;the birth of AI is definitely the gospel of program developers. If developers at this time have not really come into contact with AI, it is really a bit against the Times. Whether it is consulting problems or generating code, it can be said that the emergence of AI has solved many pain points in daily development. AI platforms such as deepseek, chatGPT, bean bags, Wenxin Yiyan, etc., as well as AI code tools cursor, trae, as well as the current Tencent plug-in codebuddy, and so on, all for the program development provider convenience.&lt;/p&gt;

&lt;p&gt;However, after using so many AI platforms, I don't know if you, as a developer of Hongmeng, feel that the codes generated by these platforms and the answers to questions given are sometimes quite different from the actual results you want, requiring many calibrations to be slightly consistent. It is not that these platforms are not accurate enough, but as a new language, the knowledge base in the market is estimated to be updated in the future, even if we have a consistent result, we still have to copy it into the project to use it, which is sometimes not very convenient.&lt;/p&gt;

&lt;p&gt;Is there an AI tool that can output knowledge or code related to Hongmeng without deliberately inputting too many instructions, with very high accuracy and can be directly written into the project? The answer is yes, that is, the AI programming tool CodeGenie in DevEcoStudio.&lt;/p&gt;

&lt;p&gt;The entrance is very simple. If you are the latest IDE, you will find the CodeGenie menu button on the vertical button on the right, as shown in the following figure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn38botj180er763ok8jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn38botj180er763ok8jf.png" alt="Image description" width="480" height="728"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;after clicking, we can enter the main page of CodeGenie.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbljmwhkt0qabv0rbcifd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbljmwhkt0qabv0rbcifd.png" alt="Image description" width="800" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At present, we need to log in to use it. We can click Sign in to log in. After logging in, we will enter the following page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv2t1oj2t34qhtd04g7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv2t1oj2t34qhtd04g7f.png" alt="Image description" width="800" height="1187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Currently, three model capabilities are provided, namely, HarmonOS, Service Widget, and deepseekr1. By default, HarmonOS is used, as shown in the following figure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkesxpeas1ho0mx6lmra.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkesxpeas1ho0mx6lmra.png" alt="Image description" width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  HarmonOS
&lt;/h2&gt;

&lt;p&gt;HarmonOS capability, there are two functions to choose from, one is Knowledge Q&amp;amp;A&lt;/p&gt;

&lt;p&gt;one is Generate Code, which is knowledge quiz and Code generation respectively.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft36li7bu6axrdbfs5ukw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft36li7bu6axrdbfs5ukw.png" alt="Image description" width="800" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a very big difference between the two abilities. One is a specialized knowledge question and answer, which will give you a layer-by-layer analysis of how to implement it and finally give the answer, while code generation will directly give the code case.&lt;/p&gt;

&lt;p&gt;Simple examples of knowledge questions and answers:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05xl2czexlax6pj0zlzp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05xl2czexlax6pj0zlzp.png" alt="Image description" width="800" height="1149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;simple example of code generation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2c3wcoh2eescnu89lzq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2c3wcoh2eescnu89lzq2.png" alt="Image description" width="800" height="1158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Widget
&lt;/h2&gt;

&lt;p&gt;Service Widget is a Service component. Using this capability, it will quickly help you implement a desktop Service card and generate it completely automatically. Of course, you can make it as consistent as possible with what you want through detailed instructions.&lt;/p&gt;

&lt;p&gt;In the following case, let it generate a three-column service card. In fact, you can describe it in more detail, such as the theme, style, component arrangement, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsmzmeh3u4vluh2f3r6ou.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsmzmeh3u4vluh2f3r6ou.png" alt="Image description" width="800" height="948"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, it will give three cases. You can choose what you need and save it to the project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqo8862knof1xenoyrzd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqo8862knof1xenoyrzd5.png" alt="Image description" width="800" height="1424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  DeepSeekR1
&lt;/h2&gt;

&lt;p&gt;this is an official improved question-and-answer function, which can quickly answer questions related to Hongmeng, and the accuracy is very high. When Consulting, you don't need to add some keywords deliberately, just ask directly. It is recommended that you choose this for consulting questions and code generation.&lt;/p&gt;

&lt;p&gt;In the following case, I casually consulted a question.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3am7wk2pvl8xpgqapl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3am7wk2pvl8xpgqapl4.png" alt="Image description" width="800" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, both the analysis and the answer are very accurate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flwcdtwiulniil9m1i7n8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flwcdtwiulniil9m1i7n8.png" alt="Image description" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above is a simple overview of CodeGenie's functions. I hope I can help friends in need.&lt;/p&gt;

</description>
      <category>codereview</category>
    </item>
    <item>
      <title>HarmonyNEXT: Immersive Effect Implementation</title>
      <dc:creator>harmony</dc:creator>
      <pubDate>Wed, 25 Jun 2025 13:24:11 +0000</pubDate>
      <link>https://dev.to/loveharmony/harmonynext-immersive-effect-implementation-58e9</link>
      <guid>https://dev.to/loveharmony/harmonynext-immersive-effect-implementation-58e9</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article tags: HarmonyOS/ArkUI&lt;br&gt;
API supported in this article&amp;gt; = 18&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;the main purpose of realizing immersive effect is to improve the user experience, make the effect of the status bar consistent with the theme of the page, and increase the visual experience. Just Imagine, if there is no immersion, it will appear very abrupt visually. As shown in the following figure, you can see that the page is red, while the status bar is white, which is very incompatible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiqzfht89yt7pajqvptt6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiqzfht89yt7pajqvptt6.png" alt="Image description" width="596" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is precisely because of immersion that the developed applications look so fresh visually. It can be said that many applications on the market have been adapted to immersion. We can open an application at will, such as WeChat, such as Alipay, such as various shopping software, and the transparent status bar at the top can be seen everywhere.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc92x76655q9nrfplf4un.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc92x76655q9nrfplf4un.png" alt="Image description" width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What we need to know is that immersive effect mainly refers to extending the application content to the edge of the screen by hiding or transparently making the status bar and navigation bar, that is, extending to the status bar area at the top and the navigation bar area at the bottom. The main purpose, as mentioned above, is to improve the user experience.&lt;/p&gt;

&lt;p&gt;In the development of Hongmeng, it can be said that it is very simple to realize an immersion type. At present, there are two ways to realize it, one is independent setting within the page, that is, avoiding safe areas, and the other is global configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safe Area Avoidance
&lt;/h2&gt;

&lt;p&gt;Safe area avoidance is mainly to achieve immersive effect by setting expandSafeArea attribute to components in the page. We must know that the so-called safe area refers to the display area of the page, that is, the area outside the status bar and navigation bar area.&lt;/p&gt;

&lt;h3&gt;
  
  
  expandSafeArea
&lt;/h3&gt;

&lt;p&gt;Click on the expandSafeArea attribute, we can enter the source code, we can see that expandSafeArea currently receives two parameters, the first parameter types, its type is Array , identified by a question mark, you can know that it is not necessary to pass parameters, its function is mainly to configure the type of extended security area, when no metadata configuration item is added, the page thing does not avoid digging holes, CUTOUT type does not take effect; The second parameter edges, its type is Array , It is also an optional parameter. Its main function is to configure the direction of expanding the security area.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; expandSafeArea(types?: Array&amp;lt;SafeAreaType&amp;gt;, edges?: Array&amp;lt;SafeAreaEdge&amp;gt;): T;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  SafeAreaType
&lt;/h3&gt;

&lt;p&gt;the enumeration types of extended security zones. Currently, there are three types.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SYSTEM&lt;/td&gt;
&lt;td&gt;the system default non-security area, including the status bar, navigation bar.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CUTOUT&lt;/td&gt;
&lt;td&gt;non-safe areas of equipment, such as bangs or dug-out screen areas.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KEYBOARD&lt;/td&gt;
&lt;td&gt;soft keyboard area.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  SafeAreaEdge
&lt;/h3&gt;

&lt;p&gt;there are currently four directions for expanding the security zone.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TOP&lt;/td&gt;
&lt;td&gt;upper area.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BOTTOM&lt;/td&gt;
&lt;td&gt;lower area.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;START&lt;/td&gt;
&lt;td&gt;Front area.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;END&lt;/td&gt;
&lt;td&gt;the tail area.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Main realization
&lt;/h3&gt;

&lt;p&gt;the implementation is very simple, the code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Column() {

    }.width("100%")
    .height("100%")
    .backgroundColor(Color.Red)
    .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if we look at the actual operation effect, we can see that both the navigation bar and the status bar have been immersive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwkangmvqhnxu3mj7rdo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwkangmvqhnxu3mj7rdo.png" alt="Image description" width="800" height="1726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to modify the icon color of the status bar, you can combine windows to achieve.&lt;/p&gt;

&lt;p&gt;In an independent page, in addition to the above security area avoidance, we can also directly obtain getLastWindow and set it. The effect is exactly the same as the security area setting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aboutToAppear(): void {
    window.getLastWindow(getContext(), (_, win) =&amp;gt; {
      win.setWindowLayoutFullScreen(true).then(() =&amp;gt; {
        console.info('Succeeded in setting the window layout to full-screen mode.');
      }).catch((err: BusinessError) =&amp;gt; {
        console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
      });
    })
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Global Settings
&lt;/h2&gt;

&lt;p&gt;in actual development, if our entire project is immersive, then we can use global configuration, which will be applied to all pages. Its implementation is mainly set by the setWindowLayoutFullScreen method in window.&lt;/p&gt;

&lt;p&gt;We can configure the following code in the EntryAbility of the main entrance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;onWindowStageCreate(windowStage: window.WindowStage): void {

    let windowClass: window.Window = windowStage.getMainWindowSync()
    windowClass.setWindowLayoutFullScreen(true).then(() =&amp;gt; {
      console.info('Succeeded in setting the window layout to full-screen mode.');
    }).catch((err: BusinessError) =&amp;gt; {
      console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in addition to the above methods, you can also obtain the window asynchronously through Promise. The code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  let window=await windowStage.getMainWindow()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when we set up the above code, if we run the project, we will find that our content page will expand into non-secure areas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxikerw6xcohe695dc5zl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxikerw6xcohe695dc5zl.png" alt="Image description" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order to solve the above problem, the content in the safe area needs to avoid the navigation bar and status bar. In this case, we need to take the overall UI view, under the status bar, we can first get the height of the status bar, and then set it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Column() {
        Text("我是标题")
          .width("100%")
          .height(40)
          .textAlign(TextAlign.Center)
          .fontColor(Color.White)
      }.width("100%")
      .padding({ top: this.navHeight })
      .backgroundColor(Color.Red)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;as you can see, our title has been displayed normally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1j16ad6bhqeph9p7a8bn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1j16ad6bhqeph9p7a8bn.png" alt="Image description" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code for obtaining the height of the status bar and navigation bar is as follows. If you need to obtain the window, you can obtain it by using window.getLastWindow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR;
let avoidArea = windowClass.getWindowAvoidArea(type);
let bottomRectHeight = avoidArea.bottomRect.height; 

let type = window.AvoidAreaType.TYPE_SYSTEM; 
let avoidArea = win.getWindowAvoidArea(type);
let topRectHeight = avoidArea.topRect.height; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another thing to note is that Immersive can change the color of the properties in the status bar, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let windowClass: window.Window = windowStage.getMainWindowSync()
    let SystemBarProperties: window.SystemBarProperties = {
      statusBarColor: '#FFC0CB',
      statusBarContentColor: "#ffffff",
    };

    try {
      windowClass.setWindowSystemBarProperties(SystemBarProperties).then(() =&amp;gt; {
        console.info('Succeeded in setting the system bar properties.');
      }).catch((err: BusinessError) =&amp;gt; {
        console.error(`Failed to set the system bar properties. Cause code: ${err.code}, message: ${err.message}`);
      });
    } catch (exception) {
      console.error(`Failed to set the system bar properties. Cause code: ${exception.code}, message: ${exception.message}`);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Precautions
&lt;/h2&gt;

&lt;p&gt;if you want to set immersion for a single page, you recommend use expandSafeArea to avoid safe areas here, because expandSafeArea attribute is set for components and will not affect other pages, but only has effect on the current page. When using expandSafeArea attribute, if the root component is a scroll component, it will not take effect, which should be noted. If the whole project needs to be immersed, you can use global configuration, and in the content area, you need to control the position of the components to avoid the status bar or navigation bar overlaying the content area.&lt;/p&gt;

</description>
      <category>harmonyos</category>
    </item>
  </channel>
</rss>
