source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-text.md
// xxx.ets @Entry @Component struct TextExample12 { @State text: string = 'Text editMenuOptions' onCreateMenu = (menuItems: Array<TextMenuItem>) => { let item1: TextMenuItem = { content: 'Custom 1', icon: $r('app.media.startIcon'), id: TextMenuItemId.of('custom1'), }; let item2: TextMe...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-text.md
// xxx.ets @Entry @Component struct TextExample13 { build() { Column({ space: 10 }) { Text("privacySensitive") .privacySensitive(true) .margin({ top: 30 }) } .alignItems(HorizontalAlign.Center) .width("100%") } }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = '' @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } controller: TextAreaController = new TextAreaController() build() { Column() { TextArea({ text: this.text, placeholder: 'The text area can hold an...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = '' controller: TextAreaController = new TextAreaController() build() { Column() { TextArea({ text: this.text, placeholder: 'The text area can hold an unlimited amount of text. input your word...', contro...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { controller: TextAreaController = new TextAreaController() @State inputValue: string = "" // Create a custom keyboard component. @Builder CustomKeyboardBuilder() { Column() { Button('x').onClick(() => { // Disable the custom keyboard. ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = '' @State enterTypes: Array<EnterKeyType> = [EnterKeyType.Go, EnterKeyType.Search, EnterKeyType.Send, EnterKeyType.Done, EnterKeyType.Next, EnterKeyType.PREVIOUS, EnterKeyType.NEW_LINE] @State index: number = 0 build() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { build() { Column() { Text("WordBreakType as NORMAL: ").fontSize(16).fontColor(0xFF0000) TextArea({ text: 'This is set wordBreak to WordBreak text Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu.' ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { build() { Row() { Column() { Text('lineHeight').fontSize(9).fontColor(0xCCCCCC) TextArea({ text: 'lineHeight unset' }) .border({ width: 1 }).padding(10).margin(5) TextArea({ text: 'lineHeight 15' }) .border({ w...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text1: string = 'This is ss01 on : 0123456789' @State text2: string = 'This is ss01 off: 0123456789' build() { Column() { TextArea({ text: this.text1 }) .fontSize(20) .margin({ top: 200 }) .fontFeature("\"ss01\" on") ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { controller: TextAreaController = new TextAreaController() @State inputValue: string = "" @State height1: string | number = '80%' @State height2: number = 100 @State supportAvoidance: boolean = true; // Create a custom keyboard component. @Builder Cu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { build() { Row() { Column() { Text('heightAdaptivePolicy').fontSize(9).fontColor(0xCCCCCC) TextArea({text: 'This is the text with the height adaptive policy set'}) .width('80%').height(90).borderWidth(1).margin(1) .minF...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets import { LengthMetrics } from '@kit.ArkUI' @Entry @Component struct TextAreaExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('TextArea lineSpacing.').fontSize(9).fontColor(0xCCCCCC) TextArea({ text: 'T...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = '' build() { Column() { // Email address autofill. TextArea({ placeholder: 'input your email...' }) .width('95%') .height(40) .margin(20) .contentType(ContentType.EMAIL_ADDRESS) .enab...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State message1: string = "They can be classified as built-in components–those directly provided by the ArkUI framework and custom components – those defined by developers" + "The built-in components include buttons radio buttonsprogress indicators and t...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State insertValue: string = "" @State deleteValue: string = "" @State insertOffset: number = 0 @State deleteOffset: number = 0 @State deleteDirection: number = 0 build() { Row() { Column() { TextArea({ text: "Insert callbacks" }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = 'TextArea editMenuOptions' onCreateMenu = (menuItems: Array<TextMenuItem>) => { let item1: TextMenuItem = { content: 'Custom 1', icon: $r('app.media.startIcon'), id: TextMenuItemId.of('Custom 1'), } let item2: ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct EllipsisModeExample { @State textIndex: number = 0 @State text: string = "As the sun begins to set, casting a warm golden hue across the sky," + "the world seems to slow down and breathe a sigh of relief. The sky is painted with hues of orange, " + " pink, and lavender, c...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
// xxx.ets @Entry @Component struct TextAreaExample { @State text: string = '' controller: TextAreaController = new TextAreaController() build() { Column() { TextArea({ text: this.text, placeholder: 'placeholder', controller: this.controller }) .placeholderColor(Co...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
import { abilityManager, Configuration } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; // xxx.ets @Entry @Component export struct TextAreaExample11 { @State minFontScale: number = 0.85; @State maxFontScale: number = 2; @State changeValue: string = 'abcde'; build() { Column...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
Create a new directory named profile in the following path: AppScope/resources/base. Inside the newly created profile directory, create a file named configuration.json. Add the following JSON code to the configuration.json file: { "configuration":{ "fontSizeScale": "followSystem", "fontSizeMaxScale": "3.2" } ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textarea.md
Modify the app.json5 file in AppScope as follows: { "app": { "bundleName": "com.example.myapplication", "vendor": "example", "versionCode": 1000000, "versionName": "1.0.0", "icon": "$media:app_icon", "label": "$string:app_name", "configuration": "$profile:configuration" } }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textclock.md
controller: TextClockController = new TextClockController();
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textclock.md
@Entry @Component struct Second { @State accumulateTime: number = 0 // Objects to import controller: TextClockController = new TextClockController() build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text('Current milliseconds is ' + t...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State text: string = '' @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } @State passwordState: boolean = false controller: TextInputController = new TextInputController() build() { Column() { // Use !! to implement two-way binding o...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State passWordSrc1: Resource = $r('app.media.ImageOne'); @State passWordSrc2: Resource = $r('app.media.ImageTwo'); @State textError: string = ''; @State text: string = ''; @State nameText: string = 'test'; @Builder itemEnd() { Select([{ value: '...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { controller: TextInputController = new TextInputController(); @State inputValue: string = ""; // Create a custom keyboard component. @Builder CustomKeyboardBuilder() { Column() { Button('x').onClick(() => { // Disable the custom keyboard...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State text: string = ''; controller: TextInputController = new TextInputController(); build() { Column() { TextInput({ placeholder: 'input ...', controller: this.controller }) .width(380) .height(60) .cancelButton({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State text: string = ''; controller: TextInputController = new TextInputController(); build() { Column() { TextInput({ text: this.text, controller: this.controller }) .placeholderFont({ size: 16, weight: 400 }) .width(336) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State submitValue: string = ''; @State text: string = ''; public readonly NUM_TEXT_MAXSIZE_LENGTH = 13; @State teleNumberNoSpace: string = ""; @State nextCaret: number = -1; // Used to record the position for the next caret setting. @State actualCh: nu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State textStrEn: string = 'This is set wordBreak to WordBreak text Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu.'; @State textStrZn: string = 'The TextArea component provides multi-line text input and automatica...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { build() { Row() { Column() { Text('lineHeight').fontSize(9).fontColor(0xCCCCCC) TextInput({ text: 'lineHeight unset' }) .border({ width: 1 }).padding(10).margin(5) TextInput({ text: 'lineHeight 15' }) .border(...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State text1: string = 'This is ss01 on : 0123456789'; @State text2: string = 'This is ss01 off: 0123456789'; build() { Column() { TextInput({ text: this.text1 }) .fontSize(20) .margin({ top: 200 }) .fontFeature("\"ss01\" on...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { controller: TextInputController = new TextInputController(); @State inputValue: string = ""; @State height1: string | number = '80%'; @State supportAvoidance: boolean = true; // Create a custom keyboard component. @Builder CustomKeyboardBuilder() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { build() { Row() { Column() { Text('heightAdaptivePolicy').fontSize(9).fontColor(0xCCCCCC) TextInput({ text: 'This is the text without the height adaptive policy set' }) .width('80%').height(50).borderWidth(1).margin(1) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State message1: string = "They can be classified as built-in components–those directly provided by the ArkUI framework and custom components – those defined by developers" + "The built-in components include buttons radio buttonsprogress indicators and ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State insertValue: string = ""; @State deleteValue: string = ""; @State insertOffset: number = 0; @State deleteOffset: number = 0; @State deleteDirection: number = 0; build() { Row() { Column() { TextInput({ text: "Insert callbacks" ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State text: string = 'TextInput editMenuOptions' onCreateMenu = (menuItems: Array<TextMenuItem>) => { let item1: TextMenuItem = { content: 'custom1', icon: $r('app.media.startIcon'), id: TextMenuItemId.of('custom1'), }; let item2:...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
import { SymbolGlyphModifier } from '@kit.ArkUI'; // xxx.ets @Entry @Component struct TextInputExample { @State text: string = ''; symbolModifier: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.trash')).fontColor([Color.Red]).fontSize(16).fontWeight(FontWeight.Regular); build() { Column() ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct EllipsisModeExample { @State text: string = "As the sun begins to set, casting a warm golden hue across the sky," + "the world seems to slow down and breathe a sigh of relief. The sky is painted with hues of orange, " + " pink, and lavender, creating a breath taking tapestr...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
// xxx.ets @Entry @Component struct TextInputExample { @State editStatus: boolean = false; @State copyValue: string = ""; @State cutValue: string = ""; @State pasteValue: string = ""; @State totalOffsetX: number = 0; @State totalOffsetY: number = 0; build() { Row() { Column() { TextInpu...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
import { abilityManager, Configuration } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; // xxx.ets @Entry @Component export struct TextAreaExample11 { @State minFontScale: number = 0.85; @State maxFontScale: number = 2; @State changeValue: string = 'abcde'; build() { Column...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
Create a new directory named profile in the following path: AppScope/resources/base. Inside the newly created profile directory, create a file named configuration.json. Add the following JSON code to the **configuration.json** file: { "configuration":{ "fontSizeScale": "followSystem", "fontSizeMaxScale": "3.2...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textinput.md
Modify the app.json5 file in AppScope as follows: { "app": { "bundleName": "com.example.myapplication", "vendor": "example", "versionCode": 1000000, "versionName": "1.0.0", "icon": "$media:app_icon", "label": "$string:app_name", "configuration": "$profile:configuration" } }
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets import { LengthMetrics } from '@kit.ArkUI' class bottom { bottom:number = 50 } let bott:bottom = new bottom() @Entry @Component struct TextPickerExample { private select: number = 1 private apfruits: string[] = ['apple1', 'apple2', 'apple3', 'apple4'] private orfruits: string[] = ['orange1', 'orange2...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select, value: this.fruits[this.select] }) ....
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select }) .onChange((value: string | string[], index: number | number[]) =...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select }) .onChange((value: string | string[], index: number | number[]) =...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select }) .onChange((value: string | string[], index: number | number[]) =...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select }) .defaultPickerItemHeight(60) .onChange((value: string | ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { @State isLoop: boolean = false private select: number = 1 private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select }) .onChange((value: string | stri...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] build() { Column() { TextPicker({ range: this.fruits, selected: 1 }) .selectedIndex(2) .onChange((value: string | string[], index: number | number[]) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-textpicker.md
// xxx.ets @Entry @Component struct TextPickerExample { private select: number = 1 private fruits: string[] = ['AAAAA', 'BBBBBBBBBBBBB', 'CCCC', 'DDDDDDDD', 'EEE'] build() { Column() { TextPicker({ range: this.fruits, selected: this.select, value: this.fruits[this.select] ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-texttimer.md
// xxx.ets @Entry @Component struct TextTimerExample { textTimerController: TextTimerController = new TextTimerController() @State format: string = 'mm:ss.SS' build() { Column() { TextTimer({ isCountDown: true, count: 30000, controller: this.textTimerController }) .format(this.format) ....
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { private selectedTime: Date = new Date('2022-07-22T08:00:00') build() { TimePicker({ selected: this.selectedTime }) .disappearTextStyle({ color: '#004aaf', font: { size: 24, weight: FontWeight.Lighter } }) .textStyle({ color: Color.Bl...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { @State isMilitaryTime: boolean = false private selectedTime: Date = new Date('2022-07-22T08:00:00') build() { Column() { Button('Switch Time Format') .margin(30) .onClick(() => { this.isMilitaryTime = !this.isMilitaryTime...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { private selectedTime: Date = new Date('2022-07-22T08:00:00') build() { Column() { TimePicker({ selected: this.selectedTime, format: TimePickerFormat.HOUR_MINUTE_SECOND }) .dateTimeOptions({ hour: "numeric", minute: "2-d...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { @State isLoop: boolean = true private selectedTime: Date = new Date('2022-07-22T12:00:00') build() { Column() { TimePicker({ selected: this.selectedTime }) .loop(this.isLoop) .onChange((value: TimePickerResult) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { private selectedTime: Date = new Date('2022-07-22T08:50:00') build() { Column() { TimePicker({ selected: this.selectedTime, format: TimePickerFormat.HOUR_MINUTE_SECOND, start: new Date('2022-07-22T08:30:00') }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { private selectedTime: Date = new Date('2022-07-22T08:50:00') build() { Column() { TimePicker({ selected: this.selectedTime, format: TimePickerFormat.HOUR_MINUTE_SECOND, end: new Date('2022-07-22T15:20:00'), }) ....
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-timepicker.md
// xxx.ets @Entry @Component struct TimePickerExample { private selectedTime: Date = new Date('2022-07-22T08:00:00') build() { Column() { TimePicker({ selected: this.selectedTime, }) .enableCascade(true) .loop(true) .onChange((value: TimePickerResult) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-toggle.md
// xxx.ets @Entry @Component struct ToggleExample { build() { Column({ space: 10 }) { Text('type: Switch').fontSize(12).fontColor(0xcccccc).width('90%') Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { Toggle({ type: ToggleType.Switch, isOn: false }) .s...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-toggle.md
// xxx.ets @Entry @Component struct ToggleExample { build() { Column({ space: 10 }) { Text('type: Switch').fontSize(12).fontColor(0xcccccc).width('90%') Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { Toggle({ type: ToggleType.Switch, isOn: false }) .s...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-toggle.md
// xxx.ets class MySwitchStyle implements ContentModifier<ToggleConfiguration> { selectedColor: Color = Color.White; lamp: string = 'string'; constructor(selectedColor: Color, lamp: string) { this.selectedColor = selectedColor; this.lamp = lamp; } applyContent(): WrappedBuilder<[ToggleConfiguration]...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-xcomponent.md
// xxx.ets import { BusinessError } from '@kit.BasicServicesKit'; import nativeRender from 'libnativerender.so'; class CustomXComponentController extends XComponentController { onSurfaceCreated(surfaceId: string): void { console.log(`onSurfaceCreated surfaceId: ${surfaceId}`); nativeRender.SetSurfaceId(BigIn...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-components-xcomponent.md
// xxx.ets @Entry @Component struct Index{ @State isLock: boolean = true; @State xc_width: number = 500; @State xc_height: number = 700; myXComponentController: XComponentController = new XComponentController(); build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyConten...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-longpressgesture.md
// xxx.ets @Entry @Component struct LongPressGestureExample { @State count: number = 0 build() { Column() { Text('LongPress onAction:' + this.count).fontSize(28) // Touch and hold the text with one finger to trigger the gesture event. .gesture( LongPressGesture({ repeat: true }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-pangesture.md
// xxx.ets @Entry @Component struct PanGestureExample { @State offsetX: number = 0 @State offsetY: number = 0 @State positionX: number = 0 @State positionY: number = 0 private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Left | PanDirection.Right }) build() { Column() ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-pinchgesture.md
// xxx.ets @Entry @Component struct PinchGestureExample { @State scaleValue: number = 1 @State pinchValue: number = 1 @State pinchX: number = 0 @State pinchY: number = 0 build() { Column() { Column() { Text('PinchGesture scale:\n' + this.scaleValue) Text('PinchGesture center:\n(' + ...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-rotationgesture.md
// xxx.ets @Entry @Component struct RotationGestureExample { @State angle: number = 0 @State rotateValue: number = 0 build() { Column() { Column() { Text('RotationGesture angle:' + this.angle) } .height(200) .width(300) .padding(20) .border({ width: 3 }) .mar...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-swipegesture.md
// xxx.ets @Entry @Component struct SwipeGestureExample { @State rotateAngle: number = 0 @State speed: number = 1 build() { Column() { Column() { Text("SwipeGesture speed\n" + this.speed) Text("SwipeGesture angle\n" + this.rotateAngle) } .border({ width: 3 }) .width(30...
application-dev\reference\apis-arkui\arkui-ts\ts-basic-gestures-tapgesture.md
// xxx.ets @Entry @Component struct TapGestureExample { @State value: string = '' build() { Column() { // The gesture event is triggered by double-tapping. Text('Click twice').fontSize(28) .gesture( TapGesture({ count: 2 }) .onAction((event: GestureEvent) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets import { LengthMetricsUnit } from '@kit.ArkUI' @Entry @Component struct LengthMetricsUnitDemo { private settings: RenderingContextSettings = new RenderingContextSettings(true); private contextPX: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings, LengthMetricsUnit.PX); private cont...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct FillStyleExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justif...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct LineWidthExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justif...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct StrokeStyleExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, just...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct LineCapExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyC...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct LineJoinExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justify...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct MiterLimit { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCon...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent('pages/Index', (err) => { windowStage.getMainWindow().then(res => { const uiCtc = res.getUIContext() uiCtc.getFont().registerFont({ familyName: 'customFont', familySrc: '/font/myFont.ttf' }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct Fonts { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: F...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct CanvasExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCo...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct TextBaseline { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyC...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct GlobalAlpha { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCo...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct LineDashOffset { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justif...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct GlobalCompositeOperation { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Cent...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ShadowBlur { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCon...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ShadowColor { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCo...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ShadowOffsetX { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justify...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ShadowOffsetY { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCon...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ImageSmoothingEnabled { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg") build() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct HeightExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCo...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct WidthExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCon...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
import { FrameNode } from '@kit.ArkUI' // xxx.ets @Entry @Component struct CanvasExample { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private text: string = '' build() { Flex({ direc...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ImageSmoothingQualityDemo { private settings: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); private img:ImageBitmap = new ImageBitmap("common/images/example.jpg...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct DirectionDemo { private settings: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.C...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct FilterDemo { private settings: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); private img: ImageBitmap = new ImageBitmap("common/images/example.jpg"); build...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets import { LengthMetrics, LengthUnit } from '@kit.ArkUI' @Entry @Component struct letterSpacingDemo { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Fle...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct FillRect { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Cent...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct StrokeRect { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center...
application-dev\reference\apis-arkui\arkui-ts\ts-canvasrenderingcontext2d.md
// xxx.ets @Entry @Component struct ClearRect { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,...