source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-background.md
// xxx.ets @Entry @Component struct BackgroundExample { @Builder renderBackground() { Column() { Progress({value : 50}) } } build() { Column() { Text("content") .width(100) .height(40) .fontColor("#FFF") .position({x:50, y:80}) .textAlign(TextAlign....
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-background.md
// xxx.ets @Entry @Component struct BackgroundBrightnessDemo { build() { Column() { Row() { Text("BackgroundBrightness") } .width(200) .height(100) .position({ x: 100, y: 100 }) .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: Adapt...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-background.md
// xxx.ets @Entry @Component struct BlurEffectsExample { build() { Column({ space: 10 }) { // Blur the font. Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%') Flex({ alignItems: ItemAlign.Center }) { Text('original text').margin(10) Text('blur text') .blur...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-background.md
// xxx.ets @Entry @Component struct Index { @State shColor: Color = Color.White; @State sizeDate: number = 20; @State rVal: number = 255; @State gVal: number = 255; @State bVal: number = 255; @State aVal: number = 0.1; @State rad: number = 40; @State satVal: number = 0.8; @State briVal: number = 1.5; ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-background.md
// xxx.ets @Entry @Component struct BackGroundBlur { private imageSize: number = 150; build() { Column({ space: 5 }) { // Use backgroundBlurStyle with an enum value to set blur parameters. Stack() { Image($r('app.media.test')) .width(this.imageSize) .height(this.imageSiz...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-border-image.md
// xxx.ets @Entry @Component struct Index { build() { Row() { Column() { Text('This is gradient color.').textAlign(TextAlign.Center).height(50).width(200) .borderImage({ source: { angle: 90, direction: GradientDirection.Left, colors: [[...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-border-image.md
// xxx.ets @Entry @Component struct BorderImage { @State WidthValue: number = 0 @State SliceValue: number = 0 @State OutSetValue: number = 0 @State RepeatValue: RepeatMode[] = [RepeatMode.Repeat, RepeatMode.Stretch, RepeatMode.Round, RepeatMode.Space] @State SelectIndex: number = 0 @State SelectText: string...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-border-image.md
// xxx.ets import { LengthMetrics } from '@kit.ArkUI' @Entry @Component struct BorderImage { @State WidthStartValue: number = 0 @State WidthEndValue: number = 0 @State SliceStartValue: number = 0 @State SliceEndValue: number = 0 @State OutSetStartValue: number = 0 @State OutSetEndValue: number = 0 @State...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-border.md
// xxx.ets @Entry @Component struct BorderExample { build() { Column() { Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { // Dashed border Text('dashed') .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE).borderRadius(10) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-border.md
// xxx.ets // The width, radius, and color attributes of border use the LocalizedEdgeWidths and LocalizedEdgeColors types. import { LengthMetrics } from '@kit.ArkUI'; @Entry @Component struct BorderExample { build() { Column() { Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-click-effect.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 }) .c...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-click.md
// xxx.ets @Entry @Component struct TouchAbleExample { @State text1: string = '' @State text2: string = '' build() { Stack() { Rect() .fill(Color.Gray).width(150).height(150) .onClick(() => { console.info(this.text1 = 'Rect Clicked') }) .overlay(this.text1, { a...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-component-id.md
// xxx.ets import { IntentionCode } from '@kit.InputKit' class Utils { static rect_left: number static rect_top: number static rect_right: number static rect_bottom: number static rect_value: Record<string, number> // Obtain the coordinates of the rectangular area occupied by the component. static getCo...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-content-modifier.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-universal-attributes-cursor.md
// xxx.ets import { pointer } from '@kit.InputKit'; @Entry @Component struct CursorControlExample { @State text: string = '' controller: TextInputController = new TextInputController() build() { Column() { Row().height(200).width(200).backgroundColor(Color.Green).position({x: 150 ,y:70}) .onHo...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-custom-property.md
// xxx.ets import { FrameNode, UIContext } from '@kit.ArkUI'; @Entry @Component struct CustomPropertyExample { build() { Column() { Text('text') Button('print').onClick(() => { const uiContext: UIContext = this.getUIContext(); if (uiContext) { const node: FrameNode | null = ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData'; @Entry @Component struct ImageExample { @State uri: string = "" @State AblockArr: string[] = [] @State BblockArr: string[] = [] @State AVisible: Visibility = Visibility.Visible @State dragSuccess :Boolean = false build() ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets @Entry @Component struct DragPreviewDemo{ @Builder dragPreviewBuilder() { Column() { Text("dragPreview") .width(150) .height(50) .fontSize(20) .borderRadius(10) .textAlign(TextAlign.Center) .fontColor(Color.Black) .backgroundColor(Color.Pink...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets @Entry @Component struct dragPreviewOptionsDemo{ build() { Row() { Column() { Image('/resource/image.jpeg') .margin({ top: 10 }) .width("30%") .draggable(true) .dragPreviewOptions({ mode: DragPreviewMode.AUTO }) Image('/resource/image.jpeg')...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
@Entry @Component struct Example { @State numbers: number[] = [0, 1, 2, 3, 4 , 5, 6, 7, 8] build() { Column({ space: 5}) { Grid() { ForEach(this.numbers, (item: number) => { GridItem() { Column() .backgroundColor(Color.Blue) .width('100%') ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
@Entry @Component struct Example { @State numbers: number[] = [0, 1, 2, 3, 4 , 5, 6, 7, 8] build() { Column({ space: 5}) { Grid() { ForEach(this.numbers, (item: number) => { GridItem() { Column() .backgroundColor(Color.Blue) .width('100%') ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets import { ImageModifier } from '@kit.ArkUI' @Entry @Component struct dragPreviewOptionsDemo{ @State myModifier: ImageAttribute = new ImageModifier().opacity(0.5) @State vis: boolean = true @State changeValue: string = '' @State submitValue: string = '' @State positionInfo: CaretOffset = { index: 0,...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets import { uniformTypeDescriptor, unifiedDataChannel } from '@kit.ArkData'; import { image } from '@kit.ImageKit'; import { request } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { fileIo } from '@kit.CoreFileKit'; import { buffer } from '@kit.ArkTS'; import { BusinessError } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets @Entry @Component struct DragPreviewDemo{ @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text("menu item 1") .fontSize(15) .width(100) .height(40) .textAlign(TextAlign.Center) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-drag-drop.md
// xxx.ets @Entry @Component struct LiftingExampleDemo { @Builder dragPreviewBuilder() { Column() { Text("dragPreview builder") .width(150) .height(50) .fontSize(20) .borderRadius(10) .textAlign(TextAlign.Center) .fontColor(Color.Black) .backgroundCo...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-draw-modifier.md
// xxx.ets import { drawing } from '@kit.ArkGraphics2D'; import { AnimatorResult } from '@kit.ArkUI'; class MyFullDrawModifier extends DrawModifier { public scaleX: number = 1; public scaleY: number = 1; drawBehind(context: DrawContext): void { const brush = new drawing.Brush(); brush.setColor({ a...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-enable.md
// xxx.ets @Entry @Component struct EnabledExample { build() { Flex({ justifyContent: FlexAlign.SpaceAround }) { // The component does not respond to clicks. Button('disable').enabled(false).backgroundColor(0x317aff).opacity(0.4) Button('enable').backgroundColor(0x317aff) } .width('10...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// xxx.ets @Entry @Component struct SafeAreaExample1 { @State text: string = '' controller: TextInputController = new TextInputController() build() { Row() { Column() .height('100%').width('100%') .backgroundImage($r('app.media.bg')).backgroundImageSize(ImageSize.Cover) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// xxx.ets @Entry @Component struct SafeAreaExample2 { @State text: string = '' controller: TextInputController = new TextInputController() build() { Column() { TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) .placeholderFont({ size: 14, weight: 40...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// xxx.ets @Entry @Component struct SafeAreaExample3 { @State text: string = '' controller: TextInputController = new TextInputController() build() { Row() { Stack() { Column() .height('100%').width('100%') .backgroundImage($r('app.media.bg')).backgroundImageSize(ImageSize.C...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// EntryAbility.ets import { KeyboardAvoidMode } from '@kit.ArkUI'; onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err, data) => {...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// xxx.ets @Entry @Component struct KeyboardAvoidExample1 { build() { Column() { Row().height("30%").width("100%").backgroundColor(Color.Gray) TextArea().width("100%").borderWidth(1) Text("I can see the bottom of the page").width("100%").textAlign(TextAlign.Center).backgroundColor('rgb(179,217,2...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// EntryAbility.ets import { KeyboardAvoidMode } from '@kit.ArkUI'; onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err, data) => {...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
// xxx.ets @Entry @Component struct KeyboardAvoidExample2 { build() { Column() { Row().height("30%").width("100%").backgroundColor(Color.Gray) TextArea().width("100%").borderWidth(1) Text("I can see the bottom of the page").width("100%").textAlign(TextAlign.Center).backgroundColor('rgb(179,217,2...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
import { hilog } from '@kit.PerformanceAnalysisKit'; import { KeyboardAvoidMode } from '@kit.ArkUI'; @Entry @Component struct KeyboardAvoidExample3 { build() { Column() { Row({space:15}) { Button('OFFSET') .onClick(() => { this.getUIContext().setKeyboardAvoidMode(KeyboardAvoid...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-expand-safe-area.md
class SwiperDataSource implements IDataSource { private list: Array<Color> = [] constructor(list: Array<Color>) { this.list = list } totalCount(): number { return this.list.length } getData(index: number): Color { return this.list[index] } registerDataChangeListener(listener: DataChangeListe...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-filter-effect.md
// xxx.ets import { uiEffect } from '@kit.ArkGraphics2D'; @Entry @Component struct FilterEffectExample { @State filterTest1: uiEffect.Filter = uiEffect.createFilter().blur(10) @State filterTest2: uiEffect.Filter = uiEffect.createFilter().blur(10) @State filterTest3: uiEffect.Filter = uiEffect.createFilter().blur...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-flex-layout.md
// xxx.ets @Entry @Component struct FlexExample { build() { Column({ space: 5 }) { Text('flexBasis').fontSize(9).fontColor(0xCCCCCC).width('90%') // Base size in the main axis // The value of flexBasis() can be 'auto' or a number, which is equivalent to .width()/.height(). Flex() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
// focusTest.ets @Entry @Component struct FocusableExample { @State inputValue: string = '' build() { Scroll() { Row({ space: 20 }) { Column({ space: 20 }) { Column({ space: 5 }) { Button('Group1') .width(165) .height(40) .fontColor(...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
// requestFocus.ets @Entry @Component struct RequestFocusExample { @State idList: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'LastPageId'] @State selectId: string = 'LastPageId' build() { Column({ space:20 }){ Row({space: 5}) { Button("id: " + this.idList[0] + " focusable(false)") .wid...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
import { ColorMetrics, LengthMetrics } from '@kit.ArkUI' @Entry @Component struct RequestFocusExample { build() { Column({ space: 30 }) { Button("small black focus box") .focusBox({ margin: new LengthMetrics(0), strokeColor: ColorMetrics.rgba(0, 0, 0), }) Button("l...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
// focusTest.ets @Entry @Component struct FocusableExample { @State inputValue: string = '' build() { Scroll() { Row({ space: 20 }) { Column({ space: 20 }) { // Labeled as Column1. Column({ space: 5 }) { Button('Group1') .width(165) .height(40) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
import { ColorMetrics, LengthMetrics } from '@kit.ArkUI' @Entry @Component struct TabStop { build() { Column({ space: 20 }) { Column({ space: 20 }) { Column({ space: 20 }) { Row({ space: 5 }) { Button("button 1") .width(200).height(70).fontColor(Color.White) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-focus.md
class MyButtonModifier implements AttributeModifier<ButtonAttribute> { applyNormalAttribute(instance: ButtonAttribute): void { instance.id('M') instance.nextFocus({forward: 'D', up: 'C', down: 'D'}) } } @Entry @Component struct Index { @State modifier: MyButtonModifier = new MyButtonModifier() @State i...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-foreground-blur-style.md
// xxx.ets @Entry @Component struct ForegroundBlurStyleDemo { build() { Column() { Text('Thin Material').fontSize(30).fontColor(0xCCCCCC) Image($r('app.media.bg')) .width(300) .height(350) .foregroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiv...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-foreground-color.md
// xxx.ets @Entry @Component struct ForegroundColorExample { build() { Column({ space: 100 }) { // Draw a circle with a diameter of 150 and the default fill color black. Circle({ width: 150, height: 200 }) // Draw a circle with a diameter of 150. Circle({ width: 150, height: 200 }).foregro...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-foreground-color.md
// xxx.ets @Entry @Component struct ColoringStrategyExample { build() { Column({ space: 100 }) { // Draw a circle with a diameter of 150 and the default fill color black. Circle({ width: 150, height: 200 }) // Draw a circle with a diameter of 150 and set its foreground color to the inverse of th...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-foreground-color.md
// xxx.ets @Entry @Component struct foregroundColorInherit { build() { Column() { Button('Foreground Color: Set to Orange').fontSize(20).foregroundColor(Color.Orange).backgroundColor(Color.Gray) Divider() Button('Foreground Color: Inherited from Parent Component When Not Set').fontSize(20).backg...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-foreground-effect.md
// xxx.ets @Entry @Component struct Index { build() { Row() { Image($r('app.media.icon')) .width(100) .height(100) .foregroundEffect({ radius: 20 }) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-gesture-modifier.md
// xxx.ets class MyButtonModifier implements GestureModifier { supportDoubleTap: boolean = true applyGesture(event: UIGestureEvent): void { if (this.supportDoubleTap) { event.addGesture( new TapGestureHandler({ count: 2, fingers: 1 }) .tag("aaa") .onAction((event: GestureEvent...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-gradient-color.md
// xxx.ets @Entry @Component struct ColorGradientExample { build() { Column({ space: 5 }) { Text('linearGradient').fontSize(12).width('90%').fontColor(0xCCCCCC) Row() .width('90%') .height(50) .linearGradient({ angle: 90, colors: [[0xff0000, 0.0], [0x0000ff,...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-gradient-color.md
@Entry @Component struct ColorGradientExample { build() { Column({ space: 5 }) { Text('sweepGradient').fontSize(12).width('90%').fontColor(0xCCCCCC) Row() .width(100) .height(100) .sweepGradient({ center: [50, 50], start: 0, end: 359, col...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-gradient-color.md
// xxx.ets @Entry @Component struct ColorGradientExample { build() { Column({ space: 5 }) { Text('radialGradient').fontSize(12).width('90%').fontColor(0xCCCCCC) Row() .width(100) .height(100) .radialGradient({ center: [50, 50], radius: 60, colors: ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-grid.md
// xxx.ets @Entry @Component struct GridContainerExample1 { build() { Column() { Text('useSizeType').fontSize(15).fontColor(0xCCCCCC).width('90%') GridContainer() { Row() { Row() { Text('Left').fontSize(25) } .useSizeType({ xs: { span: 1, o...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-hit-test-behavior.md
// xxx.ets @Entry @Component struct HitTestBehaviorExample { build() { // outer stack Stack() { Button('outer button') .onTouch((event) => { console.info('outer button touched type: ' + (event as TouchEvent).type) }) // inner stack Stack() { Button('inner bu...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-hover-effect.md
// xxx.ets @Entry @Component struct HoverExample { @State isHoverVal: boolean = false build() { Column({ space: 5 }) { Column({ space: 5 }) { Text('Scale').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 80 }) Column() .width('80%').height(200).backgroundColo...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect-sys.md
// xxx.ets import { uiEffect } from "@kit.ArkGraphics2D" // Use uiEffect.createBrightnessBlender to create a BrightnessBlender instance, which can be used to apply the brightness effect to a component. let blender: uiEffect.BrightnessBlender = uiEffect.createBrightnessBlender({ cubicRate: 0.5, quadraticRate: 0.5, ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct ImageEffectsExample { build() { Column({ space: 5 }) { // Apply the shadow effect. Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%') Image($r('app.media.image')) .width('90%') .height(30) .shadow({ radius: 10, ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct ImageExample1 { private_resource1: Resource = $r('app.media.testlinearGradientBlurOrigin') @State image_src: Resource = this.private_resource1 build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { Row({ space: 5 }) { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Component struct Component1 { @Prop renderGroupValue: boolean; build() { Row() { Row() { Row() .backgroundColor(Color.Black) .width(100) .height(100) .opacity(1) } .backgroundColor(Color.White) .width(150) .height(150) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct Index { build() { Column() { Text("blendMode") .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor('#ffff0101') Row() { Circle() .width(200) .height(200) .fill(Color.Green) .position({ x: 50, ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct Index { build() { Stack() { Column() Stack() { Image($r('app.media.r')).width('100%') Column() { Column().width("100%").height(30).invert({ low: 0, high: 1, threshold: 0.5, thresholdRange: 0.2...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct UseShadowBatchingExample { build() { Column() { Column({ space: 10 }) { Stack() { } .width('90%') .height(50) .margin({ top: 5 }) .backgroundColor(0xFFE4C4) .shadow({ radius: 120, color: Color.Gr...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct SphericalEffectExample { build() { Stack() { TextInput({ placeholder: "Enter a percentage." }) .width('50%') .height(35) .type(InputType.Number) .enterKeyType(EnterKeyType.Done) .caretColor(Color.Red) .placeholderColor(Color...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct LightUpExample { build() { Stack() { Text('This is the text content with letterSpacing 0.') .letterSpacing(0) .fontSize(12) .border({ width: 1 }) .padding(10) .width('50%') .lightUpEffect(0.6) }.alignContent(Alignment.Ce...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct PixelStretchExample { build() { Stack() { Text('This is the text content with letterSpacing 0.') .letterSpacing(0) .fontSize(12) .border({ width: 1 }) .padding(10) .clip(false) .width('50%') .pixelStretchEffect({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-image-effect.md
// xxx.ets @Entry @Component struct Index { build() { Column() { Stack() { Image($r('app.media.testImage')).width('100%').height('100%') Column() .width(150) .height(10) .systemBarEffect() .border({ radius: 5 }) .margin({ bottom: 80 }) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-layout-constraints.md
// xxx.ets @Entry @Component struct AspectRatioExample { private children: string[] = ['1', '2', '3', '4', '5', '6'] build() { Column({ space: 20 }) { Text('using container: row').fontSize(14).fontColor(0xCCCCCC).width('100%') Row({ space: 10 }) { ForEach(this.children, (item:string) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-layout-constraints.md
class ContainerInfo { label: string = ''; size: string = ''; } class ChildInfo { text: string = ''; priority: number = 0; } @Entry @Component struct DisplayPriorityExample { // Display the container size. private container: ContainerInfo[] = [ { label: 'Big container', size: '90%' }, { label: 'Mid...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-location.md
// xxx.ets @Entry @Component struct PositionExample1 { build() { Column() { Column({ space: 10 }) { // When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component. Text('align').fontSize(9).fontColor(0xCCCC...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-location.md
// xxx.ets @Entry @Component struct PositionExample2 { build() { Column({ space: 20 }) { // Set the offset of the component's upper left corner relative to the parent component's upper left corner. Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ wi...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-location.md
// xxx.ets @Entry @Component struct Example3 { build() { Column({ space: 20 }){ Text('position use Edges').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('bottom:0, right:0').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-location.md
// xxx.ets import { LengthMetrics } from '@kit.ArkUI'; @Entry @Component struct Example4 { private scroller: Scroller = new Scroller() build() { Column() { Stack({ alignContent: Alignment.End }) { Scroll(this.scroller) { Flex({ direction: FlexDirection.Column }) { RelativeCo...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct MenuExample { build() { Column() { Text('click for Menu') .bindMenu([ { value: 'Menu1', action: () => { console.info('handle Menu1 select'); } }, { value: 'Menu2', ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
@Entry @Component struct MenuExample { @State listData: number[] = [0, 0, 0]; @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { ForEach(this.listData, (item:number, index) => { Column() { Row() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct ContextMenuExample { @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text('Test menu item 1') .fontSize(20) .width(100) .height(50) .textAlign(TextAlign.Ce...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct DirectiveMenuExample { @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text('Options') Divider().strokeWidth(2).margin(5).color('#F0F0F0') Text('Hide') Divider().strokeW...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct Index { private iconStr: ResourceStr = $r("app.media.icon"); @Builder MyMenu() { Menu() { MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, conte...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct Index { private iconStr: ResourceStr = $r("app.media.icon"); @Builder MyMenu() { Menu() { MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, conte...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct Index { private iconStr: ResourceStr = $r("app.media.icon"); @State isShown: boolean = false; @Builder MyMenu() { Menu() { MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuIt...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct MenuExample { @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text('Test menu item 1') .fontSize(12) .width(200) .height(30) .textAlign(TextAlign.Center) ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets import { SymbolGlyphModifier } from '@kit.ArkUI'; @Entry @Component struct MenuExample { @State symbolIconModifier1: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_photo')).fontSize('24vp'); @State symbolIconModifier2: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_p...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct Index { private iconStr: ResourceStr = $r("app.media.app_icon"); @Builder MyMenu() { Menu() { MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, content: "Menu option" }) MenuItem({ startIcon: this.iconStr, c...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct MenuExample { build() { Stack() { Image($r('app.media.bg')) Column() { Text('click for Menu') .bindMenu([ { value: 'Menu1', action: () => { console.info('handle Menu1 select') } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-menu.md
// xxx.ets @Entry @Component struct MenuExample { build() { Stack() { Image($r('app.media.bg')) Column() { Text('click for Menu') .bindMenu([ { value: 'Menu1', action: () => { console.info('handle Menu1 select'); }...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-modal-transition.md
// xxx.ets @Entry @Component struct ModalTransitionExample { @State isShow: boolean = false @State isShow2: boolean = false @Builder myBuilder2() { Column() { Button("close modal 2") .margin(10) .fontSize(20) .onClick(() => { this.isShow2 = false; }) } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-modal-transition.md
// xxx.ets import { curves } from '@kit.ArkUI'; @Entry @Component struct ModalTransitionExample { @State @Watch("isShow1Change") isShow: boolean = false @State @Watch("isShow2Change") isShow2: boolean = false @State isScale1: number = 1; @State isScale2: number = 1; isShow1Change() { this.isShow ? this....
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-modal-transition.md
// xxx.ets @Entry @Component struct ModalTransitionExample { @State isShow: boolean = false @State isShow2: boolean = false @Builder myBuilder2() { Column() { Button("close modal 2") .margin(10) .fontSize(20) .onClick(() => { this.isShow2 = false; }) } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-modal-transition.md
// xxx.ets @Entry @Component struct ModalTransitionExample { @State isShow: boolean = false @State isShow2: boolean = false @Builder myBuilder2() { Column() { Button("close modal 2") .margin(10) .fontSize(20) .onClick(() => { this.isShow2 = false; }) } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-modal-transition.md
// xxx.ets @Entry @Component struct ModalTransitionExample { @State isShow: boolean = false @State isShow2: boolean = false @Builder myBuilder2() { Column() { Button("Close Modal 2") .margin(10) .fontSize(20) .onClick(() => { this.isShow2 = false; }) } ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-monopolize-events.md
// xxx.ets @Entry @Component struct Index { @State message: string = 'set monopolizeEvents false' @State messageOut: string = ' ' @State messageInner: string = ' ' @State monopolize: boolean = false build() { Column() { Text(this.message) .fontSize(22) .margin(10) Text(this.me...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-motionBlur.md
// xxx.ets import { curves } from '@kit.ArkUI'; @Entry @Component struct motionBlurTest { @State widthSize: number = 400 @State heightSize: number = 320 @State flag: boolean = true @State radius: number = 0 @State x: number = 0 @State y: number = 0 build() { Column() { Column() { Image...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-obscured.md
// xxx.ets @Entry @Component struct ObscuredExample { build() { Row() { Column() { Text('Text not set obscured attribute').fontSize(10).fontColor(Color.Black) Text('This is an example for text obscured attribute.') .fontSize(30) .width('600px') .fontColor(Color....
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-on-child-touch-test.md
// xxx.ets import { promptAction } from '@kit.ArkUI'; @Entry @Component struct ListExample { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] @State text: string = 'Button' build() { Column() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-on-child-touch-test.md
// xxx.ets import { promptAction } from '@kit.ArkUI'; @Entry @Component struct ListExample { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] @State text: string = 'Button' build() { Column() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-on-child-touch-test.md
// xxx.ets import { promptAction } from '@kit.ArkUI'; @Entry @Component struct ListExample { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] @State text: string = 'Button' build() { Column() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-on-touch-intercept.md
// xxx.ets @Entry @Component struct Index { isPolygon(event: TouchEvent) { return true; } build(){ Row(){ Column(){ Text("hello world") .backgroundColor(Color.Blue) .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(()=>{ console.log("Tex...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-opacity.md
// xxx.ets @Entry @Component struct OpacityExample { build() { Column({ space: 5 }) { Text('opacity(1)').fontSize(9).width('90%').fontColor(0xCCCCCC) Text().width('90%').height(50).opacity(1).backgroundColor(0xAFEEEE) Text('opacity(0.7)').fontSize(9).width('90%').fontColor(0xCCCCCC) Text()...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-outline.md
// xxx.ets @Entry @Component struct OutlineExample { build() { Column() { Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { // Dashed line Text('DASHED') .backgroundColor(Color.Pink) .outlineStyle(OutlineStyle.DASHED).outlineWidth(5).outlineC...
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-outline.md
// xxx.ets @Entry @Component struct OutlineExample { build() { Column() { Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { // Dashed line Text('DASHED') .backgroundColor(Color.Pink) .outlineStyle(OutlineStyle.DASHED).outlineWidth(5).outline...