harmony 鸿蒙Immersive Mode of the Input Method Application
Immersive Mode of the Input Method Application
When to Use
To implement consistent immersive experience, a communication mechanism between foreground applications and input method applications is provided. You can set the immersive input mode based on the immersive mode of the foreground application.
Working Principles
- The foreground application sets the desired immersive mode based on the application scenario.
- The desired immersive mode of the foreground application is then passed to the input method application through the input method framework.
- The input method application determines the final immersive mode for the input method framework based on the immersive mode of the foreground application.
Access Guide
The foreground application sets the immersive mode for the text box. The sample code is as follows:
TextArea({text: "hello world"}) .keyboardAppearance(KeyboardAppearance.IMMERSIVE)
The input method application subscribes to the text box attribute change event and detects the immersive mode desired by the foreground application through the immersiveMode field in the EditorAttribute callback. The sample code is as follows:
import { inputMethodEngine } from '@kit.IMEKit';
inputMethodEngine.getKeyboardDelegate().on("editorAttributeChanged", (attr : inputMethodEngine.EditorAttribute) => {
console.log("recv editorAttributeChanged, immersiveMode: " + attr.immersiveMode);
})
- The input method application sets the immersive mode.
- The IMMERSIVE mode is determined by the input method application.
- The input method application cannot set the IMMERSIVE mode to the input method framework.
- If the input method application receives IMMERSIVE from the foreground application, it is recommended that the input method application set the final immersive mode to LIGHT_IMMERSIVE or DARK_IMMERSIVE based on the current system color mode.
The following sample code shows how to set the immersive mode:
panel.setImmersiveMode(inputMethodEngine.ImmersiveMode.LIGHT_IMMERSIVE);
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Introduction to IME Kit
harmony 鸿蒙Setting Input Method Subtypes
harmony 鸿蒙Implementing an Input Method Application
harmony 鸿蒙Switching Between Input Methods
harmony 鸿蒙Using the Input Method in a Custom Edit Box (C/C++)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦