Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
The **\<List>** component is a scrollable container. By default, it taks up the entire screen height. When any component with a fixed height takes up part of the screen height, you need to explicitly specify **layoutWeight(1)** for the parent container of the **\<List>** component to take up the remaining height instead of the entire screen height.
The **\<List>** component is a scrollable container. By default, it takes up the entire screen height. When any component with a fixed height takes up part of the screen height, you need to explicitly specify **layoutWeight(1)** for the parent container of the **\<List>** component to take up the remaining height instead of the entire screen height.
## How do I center child components in a grid container?
The **config** module allows you to configure system accessibility features, including accessibility extension, high-contrast text, mouse buttons, and captions.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
| invertColor | [Config](#config)\<boolean>| Yes| Yes| Whether to enable color inversion.|
| daltonizationColorFilter | [Config](#config)<[DaltonizationColorFilter](#daltonizationcolorfilter)>| Yes| Yes| Configuration of the daltonization filter.|
| contentTimeout | [Config](#config)\<number>| Yes| Yes| Recommended duration for content display. The value ranges from 0 to 5000, in milliseconds.|
| animationOff | [Config](#config)\<boolean>| Yes| Yes| Whether to enable animation.|
| brightnessDiscount | [Config](#config)\<number>| Yes| Yes| Brightness discount. The value ranges from 0 to 1.0.|
| mouseKey | [Config](#config)\<boolean>| Yes| Yes| Whether to enable the mouse button feature.|
| mouseAutoClick | [Config](#config)\<number>| Yes| Yes| Interval for the automatic mouse clicks. The value ranges from 0 to 5000, in milliseconds.|
| shortkey | [Config](#config)\<boolean>| Yes| Yes| Whether to enable the accessibility extension shortcut key.|
| shortkeyTarget | [Config](#config)\<string>| Yes| Yes| Target application for the accessibility extension shortcut key. The value format is bundleName/abilityName.|
| captions | [Config](#config)\<boolean>| Yes| Yes| Whether to enable captions.|
| type | string | Yes| Listening type. The value is fixed at **'enableAbilityListsStateChanged'**, indicating that the changes in the list of enabled accessibility extension abilities.|
| callback | Callback<void> | Yes| Callback invoked when the list of enabled accessibility extension abilities changes.|
**Example**
```typescript
config.on('enableAbilityListsStateChanged',()=>{
console.info('ax extension ability enable list changed');
| type | string | No| Listening type. The value is fixed at **'enableAbilityListsStateChanged'**, indicating that the changes in the list of enabled accessibility extension abilities.|
| callback | Callback<void> | No| Callback invoked when the list of enabled accessibility extension abilities changes.|
**Example**
```typescript
config.off('enableAbilityListsStateChanged');
```
## Config
Implements configuration, acquisition, and listening for attributes.
### set
set(value: T): Promise<void>;
Sets this attribute. This API uses a promise to return the result.
| enable | boolean | Yes | Whether to return a list of activated input methods. The value **true** means to return a list of activated input methods, and **false** means to return a list of deactivated input methods. |
| callback | Array<[InputMethodProperty](#inputmethodproperty8)> | Yes | Callback used to return a list of activated or deactivated input methods.|
| callback | Array<[InputMethodProperty](#inputmethodproperty8)> | Yes | Callback used to return a list of activated or deactivated input methods.|
Displays a dialog box for selecting an input method. This API uses a promise to return the result. If any parameter is passed in, an exception is thrown.
Displays a dialog box for selecting an input method. This API uses a promise to return the result. If any parameter is passed in, an exception is thrown.
Listens for the input method binding event. This API uses a callback to return the result.
Listens for the input method binding event. This API uses a callback to return the result. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
Cancels listening for the input method binding event.
Cancels listening for the input method binding event. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
Listens for an input method event. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
| type | string | Yes | Listening type.<br>- The value **'keyboardShow'** means to listen for displaying of the input method.<br>- The value **'keyboardHide'** means to listen for hiding of the input method.|
| type | string | Yes | Listening type.<br>- The value **'keyboardShow'** means to listen for displaying of the keyboard.<br>- The value **'keyboardHide'** means to listen for hiding of the keyboard. |
| callback | void | No | Callback used to return the result. |
**Example**
```js
InputMethodEngine.on('keyboardShow',(err)=>{
console.info('keyboardShow');
InputMethodEngine.on('keyboardShow',()=>{
console.log('inputMethodEngine keyboardShow.');
});
InputMethodEngine.on('keyboardHide',()=>{
console.log('inputMethodEngine keyboardHide.');
});
```
...
...
@@ -165,7 +267,7 @@ Listens for an input method event.
Cancels listening for an input method event. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
| type | string | Yes | Listening type.<br>- The value **'keyboardShow'** means to listen for displaying of the input method.<br>- The value **'keyboardHide'** means to listen for hiding of the input method.|
| type | string | Yes | Listening type.<br>- The value **'keyboardShow'** means to listen for displaying of the keyboard.<br>- The value **'keyboardHide'** means to listen for hiding of the keyboard.|
| callback | void | No | Callback used to return the result. |
Listens for a hard keyboard even. This API uses a callback to return the key information.
Listens for a hard keyboard even. This API uses a callback to return the key information. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
| type | string | Yes | Listening type.<br>- The value **'keyDown'** means to listen for pressing of a key.<br>- The value **'keyUp'** means to listen for releasing of a key.|
| type | string | Yes | Listening type.<br>- The value **'keyDown'** means to listen for pressing of a key.<br>- The value **'keyUp'** means to listen for releasing of a key.|
| callback | [KeyEvent](#KeyEvent) | Yes| Callback used to return the key information.|
...
...
@@ -207,8 +314,15 @@ Listens for a hard keyboard even. This API uses a callback to return the key inf
Cancels listening for a hard keyboard even. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
| type | string | Yes | Listening type.<br>- The value **'keyDown'** means to listen for pressing of a key.<br>- The value **'keyUp'** means to listen for releasing of a key.|
| type | string | Yes | Listening type.<br>- The value **'keyDown'** means to listen for pressing of a key.<br>- The value **'keyUp'** means to listen for releasing of a key.|
| callback | [KeyEvent](#KeyEvent) | No | Callback used to return the key information. |
Listens for cursor context changes. This API uses a callback to return the cursor information.
Listens for cursor context changes. This API uses a callback to return the cursor information. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
Cancels listening for cursor context changes. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
Listens for text selection changes. This API uses a callback to return the text selection information.
Listens for text selection changes. This API uses a callback to return the text selection information. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
Cancels listening for text selection changes. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
Listens for text changes. This API uses a callback to return the current text content.
Listens for text changes. This API uses a callback to return the current text content. This API requires two parameters, the first one being napi_string and the second one being napi_function. If either of these parameters is not passed in, an exception is thrown.
Cancels listening for text changes. An exception is thrown in the following cases: (1) No parameter is passed; (2) Only one parameter is passed in, and it is not napi_string; (2) Two parameters are passed in, and the first parameter is not napi_string or the second parameter is not napi_function. If only one parameter is passed in, all listeners of the specified type will be canceled. If two parameters are passed in, the current listener of the specified type will be canceled.
Obtains the specific-length text before the cursor. This API uses an asynchronous callback to return the result.
Obtains the specific-length text before the cursor. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
@@ -455,7 +593,7 @@ Obtains the specific-length text before the cursor. This API uses an asynchronou
getForward(length:number): Promise<string>
Obtains the specific-length text before the cursor. This API uses an asynchronous callback to return the result.
Obtains the specific-length text before the cursor. This API uses a promise to return the result. If the required parameter is not passed in, an exception is thrown.
Obtains the specific-length text after the cursor. This API uses an asynchronous callback to return the result.
Obtains the specific-length text after the cursor. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
@@ -505,7 +654,7 @@ Obtains the specific-length text after the cursor. This API uses an asynchronous
getBackward(length:number): Promise<string>
Obtains the specific-length text after the cursor. This API uses an asynchronous callback to return the result.
Obtains the specific-length text after the cursor. This API uses a promise to return the result. If the required parameter is not passed in, an exception is thrown.
Deletes the fixed-length text before the cursor. This API uses an asynchronous callback to return the result.
Deletes the fixed-length text before the cursor. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
Deletes the fixed-length text before the cursor. This API uses an asynchronous callback to return the result.
Deletes the fixed-length text before the cursor. This API uses a promise to return the result. If the required parameter is not passed in, an exception is thrown.
Deletes the fixed-length text after the cursor. This API uses an asynchronous callback to return the result.
Deletes the fixed-length text after the cursor. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
Deletes the fixed-length text after the cursor. This API uses an asynchronous callback to return the result.
Deletes the fixed-length text after the cursor. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
Sets the Enter key to send the text to its target. This API uses an asynchronous callback to return the result.
Sets the Enter key to send the text to its target. This API uses an asynchronous callback to return the result. If the required two parameters are not passed in, an exception is thrown.
Sets the Enter key to send the text to its target. This API uses an asynchronous callback to return the result.
Sets the Enter key to send the text to its target. This API uses a promise to return the result. If the required parameter is not passed in, an exception is thrown.
Obtains the attribute of the edit box. This API uses an asynchronous callback to return the result.
Obtains the attribute of the edit box. This API uses an asynchronous callback to return the result. If the required parameter is not passed in, an exception is thrown.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **"beginSleep"**: The screen enters sleep mode.<br>- **"endSleep"**: The screen exits sleep mode.<br>- **"changeUser"**: The user is switched.|
| callback | Callback\<number\> | Yes| Callback used to return the result. |
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock fails.<br>- **2**: The unlock is canceled.|