diff --git a/en/application-dev/reference/arkui-ts/figures/arkts-progress.png b/en/application-dev/reference/arkui-ts/figures/arkts-progress.png new file mode 100644 index 0000000000000000000000000000000000000000..8e16510ddae266f037cce57857c3dc2ecc14ce2e Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/arkts-progress.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/progress.png b/en/application-dev/reference/arkui-ts/figures/progress.png deleted file mode 100644 index d50f4b47628b425b09f93bc9a44853ad79e12631..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/progress.png and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 459984f79d30f81c7d9d276077038972f743a201..c04842fffe481abd9778b5fd051420c417bc4f1f 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -1,6 +1,6 @@ # Progress -The **\** component is used to provide a progress indicator that displays the progress of content loading or an operation. +The **\** component represents a progress indicator that displays the progress of content loading or an operation. > **NOTE** > @@ -22,36 +22,36 @@ Since API version 9, this API is supported in ArkTS widgets. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| value | number | Yes| Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used.
Since API version 9, this API is supported in ArkTS widgets.| -| total | number | No| Total progress.
Default value: **100**
Since API version 9, this API is supported in ArkTS widgets.| -| type8+ | [ProgressType](#progresstype) | No| Style the progress indicator.
Default value: **ProgressType.Linear**
Since API version 9, this API is supported in ArkTS widgets.| -| styledeprecated | [ProgressStyle](#progressstyle) | No| Type of the progress indicator.
This parameter is deprecated since API version 8. You are advised to use **type** instead.
Default value: **ProgressStyle.Linear**| +| Name | Type | Mandatory | Description | +| -------------------------- | ----------------------------------- | ---- | ---------------------------------------- | +| value | number | Yes | Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used.
Since API version 9, this API is supported in ArkTS widgets.| +| total | number | No | Total progress.
Default value: **100**
Since API version 9, this API is supported in ArkTS widgets.| +| type8+ | [ProgressType](#progresstype) | No | Style of the progress indicator.
Default value: **ProgressType.Linear**
Since API version 9, this API is supported in ArkTS widgets.| +| styledeprecated | [ProgressStyle](#progressstyle) | No | Style of the progress indicator.
This parameter is deprecated since API version 8. You are advised to use **type** instead.
Default value: **ProgressStyle.Linear**| ## ProgressType Since API version 9, this API is supported in ArkTS widgets. -| Name| Description| -| -------- | -------- | -| Linear | Linear type. Since API version 9, the progress indicator adaptively switches to vertical layout if the height is greater than the width.| -| Ring8+ | Indeterminate ring type. The ring fills up as the progress increases.| -| Eclipse8+ | Eclipse type, which visualizes the progress in a way similar to the moon waxing from new to full.| -| ScaleRing8+ | Determinate ring type, which is similar to the clock scale. Since API version 9, when the outer circles of scales overlap, the progress indicator is automatically converted to the **Ring** type.| -| Capsule8+ | Capsule type. At both ends, the progress indicator works in a same manner as the eclipse type. In the middle part of the capsule, the progress indicator works in a same manner as the linear type. If the height is greater than the width, the progress indicator adaptively switches to vertical layout.| +| Name | Description | +| ---------------------- | ---------------------------------------- | +| Linear | Linear style. Since API version 9, the progress indicator adaptively switches to vertical layout if the height is greater than the width. | +| Ring8+ | Indeterminate ring style. The ring fills up as the progress increases. | +| Eclipse8+ | Eclipse style, which visualizes the progress in a way similar to the moon waxing from new to full. | +| ScaleRing8+ | Determinate ring style, which is similar to the clock scale. Since API version 9, when the outer circles of scales overlap, the progress indicator is automatically converted to the **Ring** style.| +| Capsule8+ | Capsule style. At both ends, the progress indicator works in a same manner as the eclipse style. In the middle part of the capsule, the progress indicator works in a same manner as the linear style. If the height is greater than the width, the progress indicator adaptively switches to vertical layout.| ## ProgressStyle Since API version 9, this API is supported in ArkTS widgets. -| Name | Description | -| --------- | ------------------------------------------------------------ | -| Linear | Linear type.| -| Ring | Indeterminate ring type. The ring fills up as the progress increases.| -| Eclipse | Eclipse type, which visualizes the progress in a way similar to the moon waxing from new to full.| -| ScaleRing | Determinate ring type, which is similar to the clock scale.| -| Capsule | Capsule type. At both ends, the progress indicator works in a same manner as the eclipse type. In the middle part of the capsule, the progress indicator works in a same manner as the linear type. If the height is greater than the width, the progress indicator adaptively switches to vertical layout.| +| Name | Description | +| --------- | ---------------------------------------- | +| Linear | Linear style. | +| Ring | Indeterminate ring style. The ring fills up as the progress increases. | +| Eclipse | Eclipse style, which visualizes the progress in a way similar to the moon waxing from new to full. | +| ScaleRing | Determinate ring style, which is similar to the clock scale. | +| Capsule | Capsule style. At both ends, the progress indicator works in a same manner as the eclipse style. In the middle part of the capsule, the progress indicator works in a same manner as the linear style. If the height is greater than the width, the progress indicator adaptively switches to vertical layout.| ## Attributes @@ -61,7 +61,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | -------- | -------- | -------- | | value | number | Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used. Invalid values do not take effect.
Since API version 9, this API is supported in ArkTS widgets.| | color | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.
Default value: **'\#ff007dff'**
Since API version 9, this API is supported in ArkTS widgets.| -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.
Default value: **'\#19182431'**

Since API version 9, this API is supported in ArkTS widgets.| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.
Default value: **'\#19182431'**

Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The settings of the universal attribute [backgroundColor](./ts-universal-attributes-background.md) applies to the progress indicator instead of the entire **\** component.| | style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | Component style.
- **strokeWidth**: stroke width of the progress indicator. It cannot be set in percentage. Since API version 9, if the stroke width of the ring progress bar is greater than or equal to the radius, the width is changed to half of the radius.
Default value: **4.0Vp**
- **scaleCount**: number of divisions on the determinate ring-type process indicator.
Default value: **120**
- **scaleWidth**: scale width of the ring progress bar. It cannot be set in percentage. If it is greater than the value of **strokeWidth**, the default scale width is used.
Default value: **2.0Vp**
Since API version 9, this API is supported in ArkTS widgets.| ## Events @@ -128,4 +128,4 @@ struct ProgressExample { } ``` -![progress](figures/progress.png) +![progress](figures/arkts-progress.png) diff --git a/en/application-dev/reference/arkui-ts/ts-container-ability-component.md b/en/application-dev/reference/arkui-ts/ts-container-ability-component.md index b4bb994bf095875fc9fe39a0bdd0ff1b86117e67..97b7f95f9818531355166d46b0ca5f7f5988fd6e 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-ability-component.md +++ b/en/application-dev/reference/arkui-ts/ts-container-ability-component.md @@ -29,9 +29,9 @@ AbilityComponent(want: Want) **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](../apis/js-apis-app-ability-want.md) | Yes| Description of the default ability to load.| +| Name | Type | Mandatory | Description | +| ---- | ---------------------------------------- | ---- | --------------- | +| want | [Want](../apis/js-apis-app-ability-want.md) | Yes | Description of the default ability to load.| ## Events @@ -74,5 +74,3 @@ struct MyComponent { } } ``` - - \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md b/en/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md index 148129e651983ba9ba54a017cd6d30d79272571d..4726d5481822059bfc36acfc0481fe27e7656a5e 100644 --- a/en/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md +++ b/en/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md @@ -1,12 +1,11 @@ # Custom Component Lifecycle - The lifecycle callbacks of a custom component are used to notify users of the lifecycle of the component. These callbacks are private and are invoked by the development framework at a specified time at runtime. They cannot be manually invoked from applications. - >**NOTE** > ->Promise and asynchronous callback functions can be used in lifecycle functions, for example, network resource getters and timer setters. +>- The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +>- Promise and asynchronous callback functions can be used in lifecycle functions, for example, network resource getters and timer setters. ## aboutToAppear @@ -123,8 +122,8 @@ Since API version 10, this API is supported in ArkTS widgets. **Parameters** -| Name| Type | Description | -| ------ | -------------------------- | -------------------- | +| Name | Type | Description | +| ------ | -------------------------- | ---------- | | params | { [key: string]: unknown } | Parameters used for constructing the custom component.| diff --git a/en/application-dev/reference/arkui-ts/ts-pixel-units.md b/en/application-dev/reference/arkui-ts/ts-pixel-units.md index 4f7099cc28fffbe5b72c6fa3ddd5fe0cfa1b969f..26ae5a8713858fed4427021145353a500a35b8a7 100644 --- a/en/application-dev/reference/arkui-ts/ts-pixel-units.md +++ b/en/application-dev/reference/arkui-ts/ts-pixel-units.md @@ -1,26 +1,30 @@ # Pixel Units -The framework provides four pixel units, with vp as the reference data unit. +ArkUI provides four pixel units, with vp as the reference data unit. + +>**Notes:** +> +>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. | Name | Description | | ---- | ---------------------------------------- | | px | Physical pixel unit of the screen. | -| vp | Pixel unit specific to the screen density. Pixels in this unit are converted into physical pixels of the screen based on the screen pixel density. This unit is used for values whose unit is not specified.| +| vp | Pixel unit specific to the screen density. Pixels in this unit are converted into physical pixels of the screen based on the screen pixel density. This unit is used for values whose unit is not specified. On a screen with an actual width of 1440 physical pixels, 1 vp is approximately equal to 3 px.| | fp | Font pixel, which is similar to vp and varies according to the system font size. | -| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by **designWidth**). For example, if **designWidth** is set to **720** (default value), then 1lpx is equal to 2px for a screen with an actual width of 1440 physical pixels.| +| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by **designWidth**). For example, if **designWidth** is set to **720** (default value), then 1 lpx is equal to 2 px for a screen with an actual width of 1440 physical pixels.| ## Pixel Unit Conversion Conversion between px and other pixel units is supported. -| API | Description | -| --------------------------------------------------- | ------------------------------------------------------------ | -| vp2px(value : number) : number | Converts a value in units of vp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| -| px2vp(value : number) : number | Converts a value in units of px to a value in units of vp.
Since API version 9, this API is supported in ArkTS widgets.| -| fp2px(value : number) : number | Converts a value in units of fp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| -| px2fp(value : number) : number | Converts a value in units of px to a value in units of fp.
Since API version 9, this API is supported in ArkTS widgets.| +| API | Description | +| ---------------------------------------- | ---------------------------------------- | +| vp2px(value : number) : number | Converts a value in units of vp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| +| px2vp(value : number) : number | Converts a value in units of px to a value in units of vp.
Since API version 9, this API is supported in ArkTS widgets.| +| fp2px(value : number) : number | Converts a value in units of fp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| +| px2fp(value : number) : number | Converts a value in units of px to a value in units of fp.
Since API version 9, this API is supported in ArkTS widgets.| | lpx2px(value : number) : number | Converts a value in units of lpx to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| | px2lpx(value : number) : number | Converts a value in units of px to a value in units of lpx.
Since API version 9, this API is supported in ArkTS widgets.| @@ -37,33 +41,71 @@ struct Example { Flex({ wrap: FlexWrap.Wrap }) { Column() { Text("width(220)") - .width(220).height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White).fontSize('12vp') + .width(220) + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12vp') }.margin(5) + Column() { Text("width('220px')") - .width('220px').height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White) + .width('220px') + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) }.margin(5) + Column() { Text("width('220vp')") - .width('220vp').height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White).fontSize('12vp') + .width('220vp') + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12vp') }.margin(5) + Column() { Text("width('220lpx') designWidth:720") - .width('220lpx').height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White).fontSize('12vp') + .width('220lpx') + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12vp') }.margin(5) + Column() { Text("width(vp2px(220) + 'px')") - .width(vp2px(220) + 'px').height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White).fontSize('12vp') + .width(vp2px(220) + 'px') + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12vp') }.margin(5) + Column() { Text("fontSize('12fp')") - .width(220).height(40).backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center).fontColor(Color.White).fontSize('12fp') + .width(220) + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12fp') + }.margin(5) + + Column() { + Text("width(px2vp(220))") + .width(px2vp(220)) + .height(40) + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .fontSize('12fp') }.margin(5) }.width('100%') } diff --git a/en/application-dev/reference/arkui-ts/ts-types.md b/en/application-dev/reference/arkui-ts/ts-types.md index 4542e27c073bf6623d872731c4d78dbff452189b..dd3ce725c77effe392403ed8b2102e9f8608e19b 100644 --- a/en/application-dev/reference/arkui-ts/ts-types.md +++ b/en/application-dev/reference/arkui-ts/ts-types.md @@ -158,7 +158,7 @@ The **Font** type is used to set the text style. | ------ | ---------------------------------------- | ---- | ---------------------------------------- | | size | [Length](#length) | No | Font size. If the value is of the number type, the unit fp is used. The value cannot be a percentage.| | weight | [FontWeight](ts-appendix-enums.md#fontweight) \| number \| string | No | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight.| -| family | string \| [Resource](#resource) | No | Font family of the text. Use commas (,) to separate multiple fonts. The priority of the fonts is the sequence in which they are placed. **'Arial, HarmonyOS Sans'**. Currently, only the **'HarmonyOS Sans'** font is supported.| +| family | string \| [Resource](#resource) | No | Font family of the text. Use commas (,) to separate multiple fonts. The priority of the fonts is the sequence in which they are placed. An example value is **'Arial, HarmonyOS Sans'**. Currently, only the **'HarmonyOS Sans'** font is supported.| | style | [FontStyle](ts-appendix-enums.md#fontstyle) | No | Font style. | ## Area8+ diff --git a/en/application-dev/ui/arkts-common-components-button.md b/en/application-dev/ui/arkts-common-components-button.md index 8abc45a87a9cc0ed6d0b40eaf907c2afb5692299..3040cfbdb16865189e316aab3a513f2ead8907f5 100644 --- a/en/application-dev/ui/arkts-common-components-button.md +++ b/en/application-dev/ui/arkts-common-components-button.md @@ -54,33 +54,36 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or - Capsule button (default type) + Buttons of this type have rounded corners whose radius is automatically set to half of the button height. The rounded corners cannot be reset through the **borderRadius** attribute. - + ```ts Button('Disable', { type: ButtonType.Capsule, stateEffect: false }) .backgroundColor(0x317aff) .width(90) .height(40) ``` - + ![en-us_image_0000001511421208](figures/en-us_image_0000001511421208.png) - Circle button + Buttons of this type are round. The rounded corners cannot be reset through the **borderRadius** attribute. - + ```ts Button('Circle', { type: ButtonType.Circle, stateEffect: false }) .backgroundColor(0x317aff) .width(90) .height(90) ``` - + ![en-us_image_0000001511740428](figures/en-us_image_0000001511740428.png) - + - Normal button + Buttons of this type have rounded corners set to 0. The rounded corners can be reset through the **borderRadius** attribute. - + ```ts Button('Ok', { type: ButtonType.Normal, stateEffect: true }) .borderRadius(8) @@ -88,56 +91,60 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or .width(90) .height(40) ``` - + ![en-us_image_0000001563060641](figures/en-us_image_0000001563060641.png) ## Setting Styles -- Set the border radius: +- Set the border radius. + In general cases, you can use universal attributes to define the button styles. For example, you can use the **borderRadius** attribute to set the border radius. - + ```ts Button('circle border', { type: ButtonType.Normal }) .borderRadius(20) .height(40) ``` - + ![en-us_image_0000001511900392](figures/en-us_image_0000001511900392.png) -- The **Font** type is used to set the text style. - Add a font style for text displayed on the button. - +- Set the text style. + + Add text style attributes for the button. + ```ts Button('font style', { type: ButtonType.Normal }) .fontSize(20) .fontColor(Color.Pink) .fontWeight(800) ``` - + ![en-us_image_0000001511580828](figures/en-us_image_0000001511580828.png) -- Set the background color: - You can do so by adding the **backgroundColor** attribute. - +- Set the background color. + + Add the **backgroundColor** attribute for the button. + ```ts Button('background color').backgroundColor(0xF55A42) ``` - + ![en-us_image_0000001562940477](figures/en-us_image_0000001562940477.png) -- Assign a function to the button: +- Assign a function to the button. + In this example, the delete function is assigned to the button. - + ```ts Button({ type: ButtonType.Circle, stateEffect: true }) { Image($r('app.media.ic_public_delete_filled')).width(30).height(30) }.width(55).height(55).margin({ left: 20 }).backgroundColor(0xF55A42) ``` - + ![en-us_image_0000001511740436](figures/en-us_image_0000001511740436.png) @@ -153,9 +160,10 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ``` -## Example Scenario +## Example + +- Using the button for startup -- Using the Button for Startup You can use the button for any UI element that involves the startup operation. The button triggers the predefined event based on the user's operation. For example, you can use a button in the **\** container to redirect the user to another page. ```ts @@ -194,7 +202,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ![en-us_image_0000001562700393](figures/en-us_image_0000001562700393.png) -- Use the button for submitting forms: +- Using the button for submitting forms + On the user login/registration page, you can use a button to submit a login or registration request. ```ts @@ -217,7 +226,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ![en-us_image_0000001562940473](figures/en-us_image_0000001562940473.png) -- Configure the button to float: +- Configuring the button to float + The button can remain floating when the user swipes on the screen. ```ts