source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkui\arkui-ts\ohos-atomicservice-NavPushPathHelper.md
// PageOne.ets import { NavPushPathHelper } from '@kit.ArkUI' import { BusinessError } from '@kit.BasicServicesKit'; class TmpClass { count: number = 10 } class ParamWithOp { operation: number = 1 count: number = 10 } @Builder export function PageOneBuilder(name: string, param: Object) { PageOne() } @Compon...
application-dev\reference\apis-arkui\arkui-ts\ohos-atomicservice-NavPushPathHelper.md
// PageTwo.ets class resultClass { constructor(count: number) { this.count = count; } count: number = 10 } @Builder export function PageTwoBuilder() { PageTwo() } @Component export struct PageTwo { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-animatorproperty.md
// xxx.ets @Entry @Component struct AttrAnimationExample { @State widthSize: number = 250 @State heightSize: number = 100 @State rotateAngle: number = 0 @State flag: boolean = true build() { Column() { Button('change size') .onClick(() => { if (this.flag) { this.widthS...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-arcscrollbar.md
import { ArcScrollBar } from '@kit.ArkUI'; @Entry @Component struct ArcScrollBarExample { private scroller: Scroller = new Scroller() private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; build() { Stack({ alignContent: Alignment.Center }) { Scroll(this.scroller) { Flex({ direction: FlexDire...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-blank.md
// xxx.ets @Entry @Component struct BlankExample { build() { Column() { Row() { Text('Bluetooth').fontSize(18) Blank() Toggle({ type: ToggleType.Switch }).margin({ top: 14, bottom: 14, left: 6, right: 6 }) }.width('100%').backgroundColor(0xFFFFFF).borderRadius(15).padding({ lef...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-blank.md
// xxx.ets @Entry @Component struct BlankExample { build() { Column({ space: 20 }) { // If the width of the parent container is not set, the Blank component becomes invalid. In this case, you can set min to specify the minimum width of the Blank component. Row() { Text('Bluetooth').fontSize(18...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
// xxx.ets @Entry @Component struct ButtonExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('Normal button').fontSize(9).fontColor(0xCCCCCC) Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetwe...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
// xxx.ets @Entry @Component struct SwipeGestureExample { @State count: number = 0 build() { Column() { Text(`${this.count}`) .fontSize(30) .onClick(() => { this.count++ }) if (this.count <= 0) { Button('count is negative').fontSize(30).height(50) } e...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
// xxx.ets @Entry @Component struct buttonTestDemo { @State txt: string = 'overflowTextOverlengthTextOverflow.Clip'; @State widthShortSize: number = 210; build() { Row() { Column() { Button(this.txt) .width(this.widthShortSize) .height(100) .backgroundColor(0x317af...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
// xxx.ets @Entry @Component struct ButtonExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('Normal size button').fontSize(9).fontColor(0xCCCCCC) Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Space...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
// xxx.ets @Entry @Component struct ButtonExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('Role is Normal button').fontSize(9).fontColor(0xCCCCCC) Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Sp...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
class MyButtonStyle implements ContentModifier<ButtonConfiguration> { x: number = 0 y: number = 0 selectedColor:Color = Color.Black constructor(x : number, y: number,ColorType:Color) { this.x = x this.y = y this.selectedColor = ColorType } applyContent() : WrappedBuilder<[ButtonConfiguration]> ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-button.md
@Entry @Component struct ButtonExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('Rounded rectangle button with rounded corners by default.').fontSize(9).fontColor(0xCCCCCC) Flex({ alignItems: ItemAlign.Center, jus...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-calendarpicker.md
// xxx.ets @Entry @Component struct CalendarPickerExample { private selectedDate: Date = new Date('2024-03-05') build() { Column() { Column() { CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) .edgeAlign(CalendarAlign.END) .textStyle({ color: "#ff182431", font: ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-calendarpicker.md
// xxx.ets @Entry @Component struct CalendarPickerExample { private selectedDate: Date = new Date('2025-01-15') private startDate: Date = new Date('2025-01-05') private endDate: Date = new Date('2025-01-25') build() { Column() { Column() { CalendarPicker({ hintRadius: 10, selected: this.selec...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-calendarpicker.md
// xxx.ets @Entry @Component struct CalendarPickerExample { private disabledDateRange: DateRange[] = [ { start: new Date('2025-01-01'), end: new Date('2025-01-02') }, { start: new Date('2025-01-09'), end: new Date('2025-01-10') }, { start: new Date('2025-01-15'), end: new Date('2025-01-16') }, { start...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkbox.md
// xxx.ets @Entry @Component struct CheckboxExample { build() { Flex({ justifyContent: FlexAlign.SpaceEvenly }) { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(true) .selectedColor(0xed6f21) .shape(CheckBoxShape.CIRCLE) .onChange((value: boolean) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkbox.md
// xxx.ets @Entry @Component struct Index { build() { Row() { Column() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .selectedColor(0x39a2db) .shape(CheckBoxShape.ROUNDED_SQUARE)...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkbox.md
// xxx.ets class MyCheckboxStyle implements ContentModifier<CheckBoxConfiguration> { selectedColor: Color = Color.White constructor(selectedColor: Color) { this.selectedColor = selectedColor; } applyContent() : WrappedBuilder<[CheckBoxConfiguration]> { return wrapBuilder(buildCheckbox) } } @Builder...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkbox.md
// xxx.ets @Entry @Component struct CheckboxExample { @Builder indicatorBuilder(value: number) { Column(){ Text(value > 99 ? '99+': value.toString()) .textAlign(TextAlign.Center) .fontSize(value > 99 ? '16vp': '20vp') .fontWeight(FontWeight.Medium) .fontColor('#ffffffff') ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkboxgroup.md
// xxx.ets @Entry @Component struct CheckboxExample { build() { Scroll() { Column() { // Select All button Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { CheckboxGroup({ group: 'checkboxGroup' }) .checkboxShape(CheckBoxShape.ROUNDED_SQUARE) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-checkboxgroup.md
// xxx.ets @Entry @Component struct Index { build() { Row() { Column() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { CheckboxGroup({ group: 'checkboxGroup' }) .checkboxShape(CheckBoxShape.ROUNDED_SQUARE) .selectedColor(Color.Orange) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-component3d.md
// xxx.ets @Entry @Component struct Index { scene: SceneOptions = { scene: $rawfile('gltf/DamageHemlt/glTF/DamagedHelmet.gltf'), modelType: ModelType.SURFACE}; build() { Row() { Column() { Text('GLTF Example') Component3D( this.scene ) .environment($rawfile('gltf/Environment/glTF...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-component3d.md
import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; class EngineTime { totalTimeUs = 0; deltaTimeUs = 0; }; let engineTime = new EngineTime(); let frameCount: number = 0; function TickFrame() { if (frameCount == 10) { engineTime.totalTimeUs += 1.0; engineTime.deltaTimeUs += 1.0; fram...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-containerspan.md
// xxx.ets @Component @Entry struct Index { build() { Column() { Text() { ContainerSpan() { ImageSpan($r('app.media.app_icon')) .width('40vp') .height('40vp') .verticalAlign(ImageSpanAlignment.CENTER) Span(' Hello World ! ').fontSize('16fp'...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-containerspan.md
// xxx.ets import { ContainerSpanModifier } from '@ohos.arkui.modifier' class MyContainerSpanModifier extends ContainerSpanModifier { applyNormalAttribute(instance: ContainerSpanAttribute): void { super.applyNormalAttribute?.(instance); this.textBackgroundStyle({ color: "#7F007DFF", radius: "12vp" }) } } ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datapanel.md
// xxx.ets @Entry @Component struct DataPanelExample { public valueArr: number[] = [10, 10, 10, 10, 10, 10, 10, 10, 10] build() { Column({ space: 5 }) { Row() { Stack() { // Single-segment circular data panel DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).wi...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datapanel.md
// xxx.ets @Entry @Component struct LinearGradientDataPanelExample { public values1: number[] = [20, 20, 20, 20] public color1: LinearGradient = new LinearGradient([{ color: "#65EEC9A3", offset: 0 }, { color: "#FFEF629F", offset: 1 }]) public color2: LinearGradient = new LinearGradient([{ color: "#FF67F9D...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datapanel.md
// xxx.ets @Entry @Component struct LinearGradientDataPanelExample { public values1: number[] = [20, 20, 20, 20] public color1: LinearGradient = new LinearGradient([{ color: "#65EEC9A3", offset: 0 }, { color: "#FFEF629F", offset: 1 }]) public color2: LinearGradient = new LinearGradient([{ color: "#FF67F9D...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datapanel.md
// xxx.ets @Builder function buildDataPanel(config: DataPanelConfiguration) { Column() { Column() { ForEach(config.values, (item: number, index: number) => { ChildItem({ item: item, index: index, max: config.maxValue }) }, (item: string) => item) }.padding(10) Column() { Line()....
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datepicker.md
// xxx.ets @Entry @Component struct DatePickerExample { @State isLunar: boolean = false private selectedDate: Date = new Date('2021-08-08') build() { Column() { Button('Switch Calendar') .margin({ top: 30, bottom: 30 }) .onClick(() => { this.isLunar = !this.isLunar }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datepicker.md
// xxx.ets @Entry @Component struct DatePickerExample { private selectedDate: Date = new Date('2021-08-08') build() { Column() { DatePicker({ start: new Date('1970-1-1'), end: new Date('2100-1-1'), selected: this.selectedDate }) .disappearTextStyle({ color: Color.Gra...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-datepicker.md
// xxx.ets @Entry @Component struct DatePickerExample { @State isLunar: boolean = false private selectedDate: Date = new Date('2025-01-15') @State datePickerModeList: (DatePickerMode)[] = [ DatePickerMode.DATE, DatePickerMode.YEAR_AND_MONTH, DatePickerMode.MONTH_AND_DAY, ] @State datePickerModeInd...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-divider.md
// xxx.ets @Entry @Component struct DividerExample { build() { Column() { // Use horizontal dividers. Text('Horizontal divider').fontSize(9).fontColor(0xCCCCCC) List() { ForEach([1, 2, 3], (item: number) => { ListItem() { Text('list' + item).width('100%').fontSize(1...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-formcomponent-sys.md
//card.ets @Entry @Component struct CardExample { @State formId:string = '0'; build() { Column() { Text('this is a card') .fontSize(50) .fontWeight(FontWeight.Bold) FormComponent({ id:this.formId, name:"Form1", bundle:"com.example.cardexample", ability...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge1 { @Builder descriptionBuilder() { Text('Description') .maxFontSize('30sp') .minFontSize("10.0vp") .fontColor("#fffa2a2d") .fontWeight(FontWeight.Medium) .width('100%') .height("100%") .textAlign(TextAlign.Center) } build() { Colu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge2 { @Builder descriptionBuilderImage() { Image($r('sys.media.ohos_ic_public_clock')).width(72).height(72) } build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('50') .fontWeight(FontWeight.Medium) .w...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge3 { @Builder descriptionBuilder() { Text('Description') .maxFontSize('30sp') .minFontSize("10.0vp") .fontColor("#fffa2a2d") .fontWeight(FontWeight.Medium) .width('100%') .height("100%") .textAlign(TextAlign.Center) } build() { Colu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge4 { build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('50') .maxFontSize("72.0vp") .minFontSize("10.0vp") .fontColor("#ff182431") .width('40%') .textAlign(TextAlign.Center)...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge5 { build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('50') .maxFontSize("80sp") .minFontSize("60.0vp") .fontWeight(FontWeight.Medium) .fontColor("#ff182431") .width('40%')...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge6 { build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('50') .maxFontSize('60sp') .minFontSize('30.0vp') .fontWeight(FontWeight.Medium) .fontColor("#ff182431") .width('62%')...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge7 { build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('50') .maxFontSize('60sp') .minFontSize('30.0vp') .fontWeight(FontWeight.Medium) .fontColor("#ff182431") .width('62%')...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
// xxx.ets // The example implements the customization of the gauge's content area using a Builder, utilizing a circular chart, buttons, and text boxes. When the increase button is clicked, the indicator will shift to the right; conversely, when the decrease button is clicked, the indicator will shift to the left. @Bui...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct GaugeExample { build() { Scroll() { Column({ space: 15 }) { Row() { Gauge({ value: 50, min: 1, max: 100 }) { Column() { Text('60') .maxFontSize("180sp") .minFontSize("160.0vp") .fontWeight(Fo...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-gauge.md
@Entry @Component struct Gauge2 { build() { Column() { Gauge({ value: 50, min: 1, max: 100 }) .indicator({ space: 10, icon: $r('app.media.indicator') }) .startAngle(210) .endAngle(150) .colors('#cca5d61d') .width('80%') .height('80%') .strokeWidth(18) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct ImageExample1 { build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { Row() { // Load a PNG image. Image($r('app.media.ic_camera_master_ai_leaf')) .width(110).height(110).margin(15) .overlay(...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import { http } from '@kit.NetworkKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { image } from '@kit.ImageKit'; @Entry @Component struct ImageExample2 { @State pixelMapImg: PixelMap | undefined = undefined; aboutToAppear() { this.requestImageUrl('https://www.example.com/xxx.png');// Ente...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct ImageExample3 { private imageOne: Resource = $r('app.media.earth'); private imageTwo: Resource = $r('app.media.star'); private imageThree: Resource = $r('app.media.moveStar'); @State src: Resource = this.imageOne @State src2: Resource = this.imageThree build(){ Column(){ /...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import { image } from '@kit.ImageKit' @Entry @Component struct ImageExample4 { @State imagePixelMap: image.PixelMap | undefined = undefined private aiController: ImageAnalyzerController = new ImageAnalyzerController() private options: ImageAIOptions = { types: [ImageAnalyzerType.SUBJECT, ImageAnalyzerType.TE...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct Index { @State top: number = 10 @State bottom: number = 10 @State left: number = 10 @State right: number = 10 build() { Column({ space: 5 }) { // Original image effect Image($r("app.media.landscape")) .width(200).height(200) .border({ width: 2, color: ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import {AnimationOptions, AnimatedDrawableDescriptor} from '@kit.ArkUI' import { image } from '@kit.ImageKit' @Entry @Component struct ImageExample { pixelmaps: Array<PixelMap> = []; options: AnimationOptions = {duration:2000, iterations:1}; @State animated: AnimatedDrawableDescriptor | undefined = undefined; ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import { drawing, common2D } from '@kit.ArkGraphics2D'; @Entry @Component struct ImageExample3 { private imageOne: Resource = $r('app.media.1'); private imageTwo: Resource = $r('app.media.2'); @State src: Resource = this.imageOne @State src2: Resource = this.imageTwo private ColorFilterMatrix: number[] = [1,...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct ImageExample{ build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { Row() { // Load a PNG image. Image($r('app.media.sky')) .width(110).height(110).margin(15) .overlay('png', { align: Alignme...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct ImageContentExample { @State imageSrcIndex: number = 0; @State imageSrcList: (ResourceStr | ImageContent)[] = [$r('app.media.app_icon'), ImageContent.EMPTY] build() { Column({ space: 10 }) { Image(this.imageSrcList[this.imageSrcIndex]) .width(100) .height(100) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct ImageExample { build() { Column({ space: 10 }) { Image($r("app.media.startIcon")) .width(50) .height(50) .margin({top :30}) .privacySensitive(true) } .alignItems(HorizontalAlign.Center) .width("100%") } }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import { curves } from '@kit.ArkUI'; @Entry @Component struct ImageExample11 { private curve = curves.cubicBezier(0.33, 0, 0.67, 1); @State moveImg: string[] = ['imageScanEffect']; @State moveImgVisible: Visibility = Visibility.Visible; @State durationTime: number = 1500; @State iterationsTimes: number = -1;...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
import { matrix4 } from '@kit.ArkUI' @Entry @Component struct Test { private matrix1 = matrix4.identity() .translate({ x: -400, y: -750 }) .scale({ x: 0.5, y: 0.5 }) .rotate({ x: 2, y: 0.5, z: 3, centerX: 10, centerY: 10, angle: -10 }) build() { Row() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct Index { @State borderRadiusValue: number = 10; build() { Column() { Image($r("app.media.sky")) .sourceSize({width:1393, height:1080}) .height(300) .width(300) .objectFit(ImageFit.Contain) .borderWidth(1) Image($r("app.media.sky")) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct Index { @State borderRadiusValue: number = 10; build() { Column() { Image($r("app.media.sky")) .renderMode(ImageRenderMode.Template) .height(300) .width(300) .objectFit(ImageFit.Contain) .borderWidth(1) } .height('100%') .width('...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct Index { @State borderRadiusValue: number = 10; build() { Column() { Image($r("app.media.sky")) .objectRepeat(ImageRepeat.Y) .height(300) .width(300) .objectFit(ImageFit.Contain) .borderWidth(1) } .height('100%') .width('100%') ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-image.md
@Entry @Component struct Index { build() { Column() { Text("FillColor not set") Image($r("app.media.svgExample")) .height(100) .width(100) .objectFit(ImageFit.Contain) .borderWidth(1) Text("fillColor set to ColorContent.ORIGIN") Image($r("app.media.svgExampl...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imageanimator.md
// xxx.ets @Entry @Component struct ImageAnimatorExample { @State state: AnimationStatus = AnimationStatus.Initial; @State reverse: boolean = false; @State iterations: number = 1; build() { Column({ space: 10 }) { ImageAnimator() .images([ { src: $r('app.media.img1') ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imageanimator.md
// xxx.ets import { image } from '@kit.ImageKit'; @Entry @Component struct ImageAnimatorExample { imagePixelMap: Array<PixelMap> = []; @State state: AnimationStatus = AnimationStatus.Initial; @State reverse: boolean = false; @State iterations: number = 1; @State images:Array<ImageFrameInfo> = []; async abo...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imageanimator.md
@Entry @Component struct ImageAnimatorAutoPauseTest { scroller: Scroller = new Scroller(); @State state: AnimationStatus = AnimationStatus.Running; @State reverse: boolean = false; @State iterations: number = 100; @State preCallBack: string = 'Null'; private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imagespan.md
// xxx.ets @Entry @Component struct SpanExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text() { Span('This is the Span and ImageSpan component').fontSize(25).textCase(TextCase.Normal) .decoration({ type: TextD...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imagespan.md
// xxx.ets @Component @Entry struct Index { build() { Row() { Column() { Text() { ImageSpan($r('app.media.sky'))// You are advised to use a custom local image. .width('60vp') .height('60vp') .verticalAlign(ImageSpanAlignment.CENTER) .borderRa...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imagespan.md
// xxx.ets @Entry @Component struct Index { @State src: ResourceStr = $r('app.media.app_icon'); build() { Column() { Text() { ImageSpan(this.src) .width(100).height(100) .onError((err) => { console.log("onError: " + err.message); }) .onComplete(...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imagespan.md
// xxx.ets import { drawing } from '@kit.ArkGraphics2D'; @Entry @Component struct SpanExample { private ColorFilterMatrix: number[] = [0.239, 0, 0, 0, 0, 0, 0.616, 0, 0, 0, 0, 0, 0.706, 0, 0, 0, 0, 0, 1, 0]; @State DrawingColorFilterFirst: ColorFilter | undefined = new ColorFilter(this.ColorFilterMatrix); build...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-imagespan.md
// xxx.ets import { http } from '@kit.NetworkKit'; import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; @Entry @Component struct SpanExample { @State imageAlt: PixelMap | undefined = undefined httpRequest() { // Enter an image URL. http.createHttp().request("https:...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-loadingprogress.md
// xxx.ets @Entry @Component struct LoadingProgressExample { build() { Column({ space: 5 }) { Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('90%') LoadingProgress() .color(Color.Blue) .layoutWeight(1) }.width('100%').margin({ top: 5 }) } }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-loadingprogress.md
// xxx.ets import { promptAction } from '@kit.ArkUI' class MyLoadingProgressStyle implements ContentModifier<LoadingProgressConfiguration> { enableLoading: boolean = false constructor(enableLoading: boolean) { this.enableLoading = enableLoading } applyContent(): WrappedBuilder<[LoadingProgressConfigurati...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-marquee.md
// xxx.ets @Entry @Component struct MarqueeExample { @State start: boolean = false; @State src: string = ''; @State marqueeText: string = 'Running Marquee'; private fromStart: boolean = true; private step: number = 10; private loop: number = Number.POSITIVE_INFINITY; controller: TextClockController = new ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-mediacachedimage-sys.md
@Entry @Component struct MediaCachedImageExample { build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { Row() { // Load a PNG image. MediaCachedImage($r('app.media.ic_camera_master_ai_leaf')) .width(110).height(110).margin(15) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-menu.md
@Entry @Component struct Index { @State select: boolean = true private iconStr: ResourceStr = $r("app.media.view_list_filled") private iconStr2: ResourceStr = $r("app.media.arrow_right_filled") @Builder SubMenu() { Menu() { MenuItem({ content: "Copy", labelInfo: "Ctrl+C" }) MenuItem({ content...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-menu.md
// xxx.ets import { SymbolGlyphModifier } from '@kit.ArkUI'; @Entry @Component struct Index { @State startIconModifier: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_mic')).fontSize('24vp'); @State endIconModifier: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_trash')).fontS...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navdestination.md
import { SymbolGlyphModifier } from '@kit.ArkUI'; @Component struct MyPageOne { private listScroller: Scroller = new Scroller(); private scrollScroller: Scroller = new Scroller(); private arr: number[] = []; aboutToAppear(): void { for (let i = 0; i < 30; i++) { this.arr.push(i); } } build(...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navdestination.md
@Entry @Component struct NavDestinationCustomTransition { stack: NavPathStack = new NavPathStack() @Builder pageMap(name: string) { if (name) { NavDest() } } aboutToAppear(): void { this.stack.pushPath({name: 'dest0'}) } build() { Navigation(this.stack) { // empty } ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navdestination.md
@Entry @Component struct NavDestinationSystemTransition { @Provide stack: NavPathStack = new NavPathStack() @Provide homePageTransitionType: NavigationSystemTransitionType = NavigationSystemTransitionType.DEFAULT; @Builder pageMap(name: string) { if (name === 'Fade') { Fade() } else if (name === ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navdestination.md
import { window } from '@kit.ArkUI'; @Component struct PortraitPage { private stack: NavPathStack | undefined = undefined; build() { NavDestination() { Stack({alignContent: Alignment.Center}) { Button('push LANDSCAPE page').onClick(() => { this.stack?.pushPath({name: 'landscape'}) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// xxx.ets class A { text: string = '' num: number = 0 } @Entry @Component struct NavigationExample { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] @State currentIndex: number = 0 @Builder NavigationTitle() { Column() { Text('Title') .fontColor('#182431') .fontSize(30) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// Index.ets @Entry @Component struct NavigationExample { pageInfos: NavPathStack = new NavPathStack() isUseInterception: boolean = false; registerInterception() { this.pageInfos.setInterception({ // Interception before page redirection, allowing for stack operations. The setting takes effect in the cu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageOne.ets class TmpClass { count: number = 10 } @Builder export function PageOneBuilder(name: string, param: Object) { PageOne() } @Component export struct PageOne { pageInfos: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { Button('pushPathByName', { stateEff...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageTwo.ets @Builder export function PageTwoBuilder(name: string, param: Object) { PageTwo() } @Component export struct PageTwo { pathStack: NavPathStack = new NavPathStack() private menuItems: Array<NavigationMenuItem> = [ { value: "1", icon: 'resources/base/media/undo.svg', }, { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// Index.ets import { CustomTransition, AnimateCallback } from './CustomNavigationUtils' @Entry @Component struct NavigationExample { pageInfos: NavPathStack = new NavPathStack(); aboutToAppear() { if (this.pageInfos === undefined) { this.pageInfos = new NavPathStack(); } this.pageInfos.pushPath...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageOne.ets import { CustomTransition } from './CustomNavigationUtils'; @Builder export function PageOneBuilder(name: string, param: Object) { PageOne() } @Component export struct PageOne { pageInfos: NavPathStack = new NavPathStack(); @State translateX: string = '0'; pageId: string = ''; rectWidth: numb...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageTwo.ets import { CustomTransition } from './CustomNavigationUtils' @Builder export function PageTwoBuilder(name: string, param: Object) { PageTwo({ param: param as number }) } @Component export struct PageTwo { pageInfos: NavPathStack = new NavPathStack(); @State translateX: string = '0'; pageId: strin...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// CustomNavigationUtils.ets // Custom API to save the transition animation callback and parameters related to a page. export interface AnimateCallback { finish: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined; start: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined; onFin...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// Index.ets @Entry @Component struct NavigationExample { pageInfo: NavPathStack = new NavPathStack() build() { Navigation(this.pageInfo) { Column() { Button('StartTest', { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageOne.ets import { BusinessError } from '@kit.BasicServicesKit'; class TmpClass { count: number = 10 } class ParamWithOp { operation: number = 1 count: number = 10 } @Builder export function PageOneBuilder(name: string, param: Object) { PageOne() } @Component export struct PageOne { pageInfo: NavPath...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageTwo.ets class resultClass { constructor(count: number) { this.count = count; } count: number = 10 } @Builder export function PageTwoBuilder() { PageTwo() } @Component export struct PageTwo { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
let COLOR1: string = "#80004AAF"; let COLOR2: string = "#802787D9"; let BLUR_STYLE_1: BlurStyle = BlurStyle.BACKGROUND_THIN; let BLUR_STYLE_2: BlurStyle = BlurStyle.BACKGROUND_THICK; let BLUR_STYLE_OPTION_1: BackgroundBlurStyleOptions = { colorMode: ThemeColorMode.DARK, adaptiveColor: AdaptiveColor.DEFAULT, blurO...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
@Entry @Component struct NavigationExample1 { @State childNavStack: NavPathStack = new NavPathStack(); build() { Navigation() { Stack({ alignContent: Alignment.Center }) { Navigation(this.childNavStack) { Button('push Path to parent Navigation', { stateEffect: true, type: ButtonType.Cap...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// PageOne.ets @Builder export function PageOneBuilder(name: string) { NavDestination() { Text("this is " + name) } .title(name) }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
class PageParam { constructor(num_: number) { this.num = num_; } num: number = 0; } @Builder export function PageOneBuilder(name: string, param: Object) { PageOne() } @Component struct PageOne { private stack: NavPathStack | null = null; private name: string = ""; private paramNum: number = 0; b...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
@Builder export function PageOneBuilder(name: string, param: Object) { PageOneComponent() } @Component struct PageOneComponent { private stack: NavPathStack | null = null; @State eventStr: string = ""; build() { NavDestination() { Column() { Text("event: " + this.eventStr) Button('pu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
@Entry @Component struct NavigationExample { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; private scrollerForScroll: Scroller = new Scroller(); @State barStyle: BarStyle = BarStyle.STANDARD; build() { Column() { Navigation() { Column() { Scroll(this.scrollerForScr...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
class DerivedNavPathStack extends NavPathStack { // usr defined property 'id' id: string = "__default__" // new function in derived class setId(id: string) { this.id = id; } // new function in derived class getInfo(): string { return "this page used Derived NavPathStack, id: " + this.id } /...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
import { SymbolGlyphModifier } from '@kit.ArkUI'; @Entry @Component struct NavigationExample { @Provide('navPathStack') navPathStack: NavPathStack = new NavPathStack(); @State menuItems: Array<NavigationMenuItem> = [ { value: 'menuItem1', icon: 'resources/base/media/ic_public_ok.svg' // Icon resour...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
import { LengthMetrics } from '@kit.ArkUI'; import { TextModifier } from '@ohos.arkui.modifier'; class MainTitleTextModfier extends TextModifier { useStyle1: boolean = true; applyNormalAttribute(instance: TextModifier): void { if (this.useStyle1) { console.log(`testTag mainTitle use style1`); inst...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-navigation.md
// Index.ets import { AnimateCallback, CustomTransition } from './CustomTransitionUtils' @Entry @Component struct NavigationCustomTransitionExample { pageInfos: NavPathStack = new NavPathStack(); aboutToAppear() { this.pageInfos.pushPath({ name: 'PageOne' }, false); } build() { Navigation(this.pageIn...