source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsDivider1 { private controller1: TabsController = new TabsController(); @State dividerColor: string = 'red'; @State strokeWidth: number = 2; @State startMargin: number = 0; @State endMargin: number = 0; @State nullFlag: boolean = false; build() { Column() { ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsOpaque { @State message: string = 'Hello World'; private controller: TabsController = new TabsController(); private controller1: TabsController = new TabsController(); @State selfFadingFade: boolean = true; build() { Column() { Button('Set Tab to Fade').width...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct barHeightTest { @State arr: number[] = [0, 1, 2, 3]; @State barOverlap: boolean = true; build() { Column() { Text(`barOverlap ${this.barOverlap}`).fontSize(16) Button('Change barOverlap').width('100%').margin({ bottom: '12vp' }) .onClick((event?: ClickE...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample5 { private controller: TabsController = new TabsController(); @State gridMargin: number = 10; @State gridGutter: number = 10; @State sm: number = -2; @State clickedContent: string = ''; build() { Column() { Row() { Button('gridMargin+10 ' + ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets interface itemType { text: string, backgroundColor: Color } @Entry @Component struct TabsCustomAnimationExample { @State data: itemType[] = [ { text: 'Red', backgroundColor: Color.Red }, { text: 'Yellow', backgroundColor: Color.Yellow }, { text: 'Blue'...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
//xxx.ets @Entry @Component struct TabsExample { @State selectedIndex: number = 2; @State currentIndex: number = 2; private controller: TabsController = new TabsController(); @Builder tabBuilder(title: string,targetIndex: number) { Column(){ Image(this.selectedIndex === targetIndex ? $r('app.media.st...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// EntryAbility.ets import { Configuration, UIAbility } from '@kit.AbilityKit'; import { i18n } from '@kit.LocalizationKit'; import { CommonUtil } from '../common/CommonUtil'; export default class EntryAbility extends UIAbility { onConfigurationUpdate(newConfig: Configuration): void { // Listen for system config...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// CommonUtil.ets import { i18n, intl } from '@kit.LocalizationKit'; export class CommonUtil { private static isRTL: boolean = i18n.isRTL((new intl.Locale()).language); public static setIsRTL(isRTL: boolean): void { CommonUtil.isRTL = isRTL; } public static getIsRTL(): boolean { return CommonUtil.isR...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets import { LengthMetrics } from '@kit.ArkUI'; import { CommonUtil } from '../common/CommonUtil'; @Entry @Component struct TabsExample { @State colorArray: [string, string][] = [['green', '#00CB87'], ['blue', '#007DFF'], ['yellow', '#FFBF00'], ['pink', '#E67C92']]; @State currentIndex: number = 0; @S...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets import { BusinessError } from '@kit.BasicServicesKit'; @Entry @Component struct TabsPreloadItems { @State currentIndex: number = 1; private tabsController: TabsController = new TabsController(); build() { Column() { Tabs({ index: this.currentIndex, controller: this.tabsController }) { ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample { private controller: TabsController = new TabsController(); build() { Column() { Button('Set TabBar Translation Distance').margin({ top: 20 }) .onClick(() => { this.controller.setTabBarTranslate({ x: -20, y: -20 }); }) Butt...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets class MyDataSource implements IDataSource { private list: number[] = []; constructor(list: number[]) { this.list = list; } totalCount(): number { return this.list.length; } getData(index: number): number { return this.list[index]; } registerDataChangeListener(listener: DataCha...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample { @State currentIndex: number = 0; @State currentAnimationMode: AnimationMode = AnimationMode.CONTENT_FIRST; private controller: TabsController = new TabsController(); private data: number[] = []; aboutToAppear(): void { for (let i = 0; i < 10; i++) { ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets import { CommonModifier } from '@kit.ArkUI'; @Entry @Component struct TabsBarModifierExample { @State selectedIndex: number = 2; @State currentIndex: number = 2; @State isClip: boolean = false; @State tabBarModifier: CommonModifier = new CommonModifier(); private controller: TabsController = new T...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets import { CommonModifier } from '@kit.ArkUI'; @Entry @Component struct TabsBarModifierExample { private controller: TabsController = new TabsController(); @State text: string = 'Text'; @State isVertical: boolean = false; @State tabBarModifier: CommonModifier = new CommonModifier(); build() { C...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample { @State fontColor: string = '#182431'; @State selectedFontColor: string = '#007DFF'; @State currentIndex: number = 0; @State selectedIndex: number = 0; private controller: TabsController = new TabsController(); @Builder tabBuilder(index: number, name: string...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
@Entry @Component struct TabsExample { build() { Tabs() { TabContent() { MyComponent({ color: '#00CB87' }) }.tabBar(SubTabBarStyle.of('green')) TabContent() { MyComponent({ color: '#007DFF' }) }.tabBar(SubTabBarStyle.of('blue')) TabContent() { MyComponent({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample { build() { Column() { // Use barBackgroundBlurStyle with an enumerated value to set blur parameters. Stack() { Image($r('app.media.startIcon')) Tabs() { TabContent() { Column().width('100%').height('100%').backgroun...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
// xxx.ets @Entry @Component struct TabsExample { @State edgeEffect: EdgeEffect = EdgeEffect.Spring; build() { Column() { Tabs() { TabContent() { Column().width('100%').height('100%').backgroundColor('#00CB87') }.tabBar('green') TabContent() { Column().width('...
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md
import { curves } from '@kit.ArkUI'; interface TabsItemType { text: string, backgroundColor: ResourceColor } @Entry @Component struct TabsExample { private tabsController: TabsController = new TabsController(); private curves: (Curve | ICurve) [] = [ curves.interpolatingSpring(-1, 1, 328, 34), curves.spri...
application-dev\reference\apis-arkui\arkui-ts\ts-container-ui-extension-component-sys.md
import { ComponentContent } from '@kit.ArkUI'; class Params { } @Builder function LoadingBuilder(params: Params) { Column() { LoadingProgress() .color(Color.Blue) } } @Builder function AreaChangePlaceholderBuilder(params: Params) { Column() { } .width('100%') .height('100%') .backgroundColor(Colo...
application-dev\reference\apis-arkui\arkui-ts\ts-container-ui-extension-component-sys.md
import { UIExtensionAbility, UIExtensionContentSession, Want } from '@kit.AbilityKit'; const TAG: string = '[UIExtAbility]' export default class UIExtAbility extends UIExtensionAbility { onCreate() { console.log(TAG, `UIExtAbility onCreate`) } onForeground() { console.log(TAG, `UIExtAbility onForegroun...
application-dev\reference\apis-arkui\arkui-ts\ts-container-ui-extension-component-sys.md
import { UIExtensionContentSession } from '@kit.AbilityKit'; let storage = LocalStorage.getShared() AppStorage.setOrCreate('message', 'UIExtensionAbility') @Entry(storage) @Component struct Extension { @StorageLink('message') storageLink: string = ''; private session: UIExtensionContentSession | undefined = stora...
application-dev\reference\apis-arkui\arkui-ts\ts-container-ui-extension-component-sys.md
@Entry @Component struct Second { @State message1: string = 'Hello World 1' @State message2: string = 'Hello World 2' @State message3: string = 'Hello World 3' @State visible: Visibility = Visibility.Hidden @State wid: number = 300 @State hei: number = 300 private scroller: Scroller = new Scroller(); pr...
application-dev\reference\apis-arkui\arkui-ts\ts-container-ui-extension-component-sys.md
@Entry @Component struct Extension { @StorageLink('message') storageLink: string = ''; private scroller: Scroller = new Scroller(); private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8] build() { Column() { // Scrollable container component. Scroll(this.scroller) { Column() { Te...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// WaterFlowDataSource.ets // Object that implements the IDataSource API, which is used by the WaterFlow component to load data. export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i = 0; i < 100; ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { WaterFlowDataSource } from './WaterFlowDataSource'; @Entry @Component struct WaterFlowDemo { @State minSize: number = 80; @State maxSize: number = 180; @State fontSize: number = 24; @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; scroller: Scrolle...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { WaterFlowDataSource } from './WaterFlowDataSource'; @Entry @Component struct WaterFlowDemo { @State minSize: number = 80; @State maxSize: number = 180; @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; dataSource: WaterFlowDataSource = new WaterFlowDa...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { WaterFlowDataSource } from './WaterFlowDataSource'; @Reusable @Component struct ReusableFlowItem { @State item: number = 0; // Invoked when a reusable custom component is re-added to the component tree from the reuse cache. The component state variable can be updated here to display the corr...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { WaterFlowDataSource } from './WaterFlowDataSource'; import { image } from '@kit.ImageKit'; @Reusable @Component struct ReusableFlowItem { @State item: number = 0; // Invoked when a reusable custom component is re-added to the component tree from the reuse cache. The component state variable ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { LengthMetrics } from '@kit.ArkUI'; import { WaterFlowDataSource } from './WaterFlowDataSource'; @Entry @Component struct WaterFlowDemo { @State minSize: number = 80; @State maxSize: number = 180; @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; dataS...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { WaterFlowDataSource } from './WaterFlowDataSource'; @Entry @Component struct WaterFlowDemo { @State minSize: number = 80; @State maxSize: number = 180; @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; dataSource: WaterFlowDataSource = new WaterFlowDa...
application-dev\reference\apis-arkui\arkui-ts\ts-container-waterflow.md
// Index.ets import { ComponentContent, UIContext } from "@kit.ArkUI"; import { WaterFlowDataSource } from './WaterFlowDataSource'; class Params { text: string = ""; constructor(text: string) { this.text = text; } } @Builder function buildText(params: Params) { Column() { Text(params.text) .fon...
application-dev\reference\apis-arkui\arkui-ts\ts-container-with-theme.md
{ "color": [ { "name": "start_window_background", "value": "#FFFFFF" } ] }
application-dev\reference\apis-arkui\arkui-ts\ts-container-with-theme.md
// Specify the local color mode. @Entry @Component struct Index { build() { Column() { // System default Column() { Text('WithTheme not used') .fontSize(40) .fontWeight(FontWeight.Bold) } .justifyContent(FlexAlign.Center) .width('100%') .height('33%') ...
application-dev\reference\apis-arkui\arkui-ts\ts-container-with-theme.md
// Customize the default theme for components in the WithTheme scope. import { CustomTheme, CustomColors } from '@kit.ArkUI'; class GreenColors implements CustomColors { fontPrimary = '#ff049404'; fontEmphasize = '#FF00541F'; fontOnPrimary = '#FFFFFFFF'; compBackgroundTertiary = '#1111FF11'; backgroundEmphas...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
import { UIContext } from '@kit.ArkUI'; @Entry @Component struct MyComponent { aboutToAppear() { let uiContext: UIContext = this.getUIContext(); } build() { // ... } }
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
@Entry @Component struct MyComponent { aboutToAppear() { let uniqueId: number = this.getUniqueId(); } build() { // ... } }
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
import { uiObserver } from '@kit.ArkUI' @Component export struct NavDestinationExample { build() { NavDestination() { MyComponent() } } } @Component struct MyComponent { navDesInfo: uiObserver.NavDestinationInfo | undefined aboutToAppear() { // this refers to the custom node MyComponent and...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
// Index.ets @Entry @Component struct NavigationExample { pageInfo: NavPathStack = new NavPathStack(); build() { Navigation(this.pageInfo) { Column() { Button('pageOne', { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) ...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
// PageOne.ets import { uiObserver } from '@kit.ArkUI' @Builder export function PageOneBuilder() { PageOneComponent(); } @Component export struct PageOneComponent { navDesInfo: uiObserver.NavDestinationInfo | undefined; @State text: string = ''; build() { NavDestination() { Column() { Button...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
//route_map.json { "routerMap": [ { "name": "pageOne", "pageSourceFile": "src/main/ets/pages/PageOne.ets", "buildFunction": "PageOneBuilder", "data": { "description": "this is pageOne" } } ] }
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
// index.ets import { uiObserver } from '@kit.ArkUI' @Entry @Component struct MainPage { pathStack: NavPathStack = new NavPathStack() build() { Navigation(this.pathStack) { // ... }.id("NavigationId") } } @Component export struct PageOne { pathStack: NavPathStack = new NavPathStack() aboutT...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
import { uiObserver } from '@kit.ArkUI' @Entry @Component struct MyComponent { aboutToAppear() { let info: uiObserver.RouterPageInfo | undefined = this.queryRouterPageInfo(); } build() { // ... } }
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-api.md
import { BusinessError } from '@kit.BasicServicesKit'; import { ComponentContent } from '@kit.ArkUI'; class Params { text: string = "" constructor(text: string) { this.text = text; } } @ComponentV2 struct MyComponent { build() { Column() { Button('Close Dialog') .onClick(() => { ...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-layout.md
// xxx.ets @Entry @Component struct Index { build() { Column() { CustomLayout({ builder: ColumnChildren }) } } } @Builder function ColumnChildren() { ForEach([1, 2, 3], (index: number) => {// LazyForEach is not supported. Text('S' + index) .fontSize(30) .width(100) .height(100...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-layout.md
// xxx.ets @Entry @Component struct Index { build() { Column() { CustomLayout({ builder: ColumnChildren }) } .justifyContent(FlexAlign.Center) .width("100%") .height("100%") } } @Builder function ColumnChildren() { ForEach([1, 2, 3], (item: number, index: number) => { // LazyForEach is ...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-layout.md
import { FrameNode, NodeController } from '@kit.ArkUI'; @Entry @Component struct Index { build() { Column() { CustomLayout() } } } class MyNodeController extends NodeController { private rootNode: FrameNode | null = null; makeNode(uiContext: UIContext): FrameNode | null { this.rootNode = new ...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-layout.md
// xxx.ets @Entry @Component struct Index { build() { Column() { CustomLayout() { ForEach([1, 2, 3], (index: number) => { Text('Sub' + index) .fontSize(30) .borderWidth(2) }) } } } } @Component struct CustomLayout { @Builder doNothingBuilde...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// xxx.ets @Entry @Component struct IndexComponent { @State textColor: Color = Color.Black; onPageShow() { this.textColor = Color.Blue; console.info('IndexComponent onPageShow'); } onPageHide() { this.textColor = Color.Transparent; console.info('IndexComponent onPageHide'); } onBackPress(...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// pages/Index.ets import { router } from '@kit.ArkUI'; export class routerParam { msg: string = '__NA__'; constructor(msg: string) { this.msg = msg; } } @Entry @Component struct Index { aboutToAppear(): void { console.log('onNewParam', 'Index aboutToAppear'); } onNewParam(param: ESObject) { ...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// pages/PageOne.ets import { router } from '@kit.ArkUI'; import { routerParam } from './Index'; @Entry @Component struct PageOne { aboutToAppear(): void { console.log('onNewParam', 'PageOne aboutToAppear'); } onNewParam(param: ESObject) { console.log('onNewParam', 'PageOne onNewParam, param: ' + JSON.s...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// xxx.ets export class Message { value: string | undefined; constructor(value: string) { this.value = value } } @Entry @Component struct Index { @State switch: boolean = true build() { Column() { Button('Hello World') .fontSize(50) .fontWeight(FontWeight.Bold) .onClic...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
@Entry @ComponentV2 struct Index { @Local condition: boolean = true; build() { Column() { Button('Recycle/Reuse').onClick(()=>{this.condition=!this.condition;}) // Click to switch the recycle/reuse state. if (this.condition) { ReusableV2Component() } } } } @ReusableV2 @ComponentV...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// xxx.ets export class Message { value: string | undefined; constructor(value: string) { this.value = value; } } @Entry @Component struct Index { @State switch: boolean = true; build() { Column() { Button('Hello World') .fontSize(50) .fontWeight(FontWeight.Bold) .onCl...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
// xxx.ets import { CustomTheme, CustomColors, Theme, ThemeControl } from '@kit.ArkUI'; class BlueColors implements CustomColors { fontPrimary = Color.White; backgroundPrimary = Color.Blue; brand = Color.Blue; // Brand color } class PageCustomTheme implements CustomTheme { colors?: CustomColors; constructo...
application-dev\reference\apis-arkui\arkui-ts\ts-custom-component-lifecycle.md
import { CustomTheme, CustomColors, Theme, ThemeControl } from '@kit.ArkUI'; class BlueColors implements CustomColors { fontPrimary = Color.White; backgroundPrimary = Color.Blue; brand = Color.Blue; // Brand color } class PageCustomTheme implements CustomTheme { colors?: CustomColors; constructor(colors: C...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-circle.md
// xxx.ets @Entry @Component struct CircleExample { build() { Column({ space: 10 }) { // Draw a circle whose diameter is 150. Circle({ width: 150, height: 150 }) // Draw a circle whose diameter is 150 and stroke color is red. (If the width and height values are different, the smaller value will ...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-ellipse.md
// xxx.ets @Entry @Component struct EllipseExample { build() { Column({ space: 10 }) { // Draw a 150 x 80 ellipse. Ellipse({ width: 150, height: 80 }) // Draw a 150 x 100 ellipse with blue strokes. Ellipse() .width(150) .height(100) .fillOpacity(0) .stroke(C...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-line.md
// xxx.ets @Entry @Component struct LineExample { build() { Column({ space: 10 }) { // The coordinates of the start and end points of the line are determined relative to the coordinates of the drawing area of the <Line> component. Line() .width(200) .height(150) .startPoint([0,...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-line.md
// xxx.ets @Entry @Component struct LineExample1 { build() { Row({ space: 10 }) { // Set LineCapStyle to Butt. Line() .width(100) .height(200) .startPoint([50, 50]) .endPoint([50, 200]) .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCap...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-line.md
// xxx.ets @Entry @Component struct LineExample { build() { Column() { Line() .width(300) .height(30) .startPoint([50, 30]) .endPoint([300, 30]) .stroke(Color.Black) .strokeWidth(10) // Set the interval for strokeDashArray to 50. Line() .wi...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-path.md
// xxx.ets @Entry @Component struct PathExample { build() { Column({ space: 10 }) { Text('Straight line') .fontSize(11) .fontColor(0xCCCCCC) .width('90%') // Draw a straight line whose length is 600 px and width is 3 vp. Path() .width('600px') .height('10p...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-polygon.md
// xxx.ets @Entry @Component struct PolygonExample { build() { Column({ space: 10 }) { // Draw a triangle in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (50, 100). Polygon({ width: 100, height: 100 }) .points([[0, 0], [50, 100], [100, 0...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-polyline.md
// xxx.ets @Entry @Component struct PolylineExample { build() { Column({ space: 10 }) { // Draw a polyline in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 100), and the passing point is (20,60). Polyline({ width: 100, height: 100 }) .points([[0, 0], [20, 60], [100, ...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-rect.md
// xxx.ets @Entry @Component struct RectExample { build() { Column({ space: 10 }) { Text('normal').fontSize(11).fontColor(0xCCCCCC).width('90%') // Draw a 90% x 50 rectangle. Column({ space: 5 }) { Text('normal').fontSize(9).fontColor(0xCCCCCC).width('90%') // Draw a 90% x 50 rec...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-rect.md
// xxx.ets @Entry @Component struct RectExample { build() { Column({ space: 10 }) { Column() .width(100) .height(100) .linearGradient({ direction: GradientDirection.Right, colors: [[0xff0000, 0.0], [0x0000ff, 0.3], [0xffff00, 1.0]] }) .clipShape(ne...
application-dev\reference\apis-arkui\arkui-ts\ts-drawing-components-shape.md
// xxx.ets @Entry @Component struct ShapeExample { build() { Column({ space: 10 }) { Text('basic').fontSize(11).fontColor(0xCCCCCC).width(320) // Draw a 300 x 50 rectangle with strokes at (-2, -2). The fill color is 0x317AF7, the stroke color is black, the stroke width is 4, the stroke dash is 20, the...
application-dev\reference\apis-arkui\arkui-ts\ts-drawingrenderingcontext.md
// xxx.ets @Entry @Component struct CanvasExample { private context: DrawingRenderingContext = new DrawingRenderingContext() build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Canvas(this.context) .width('100%') .height('1...
application-dev\reference\apis-arkui\arkui-ts\ts-explicit-animatetoimmediately.md
// xxx.ets @Entry @Component struct AnimateToImmediatelyExample { @State widthSize: number = 250 @State heightSize: number = 100 @State opacitySize: number = 0 private flag: boolean = true build() { Column() { Column() .width(this.widthSize) .height(this.heightSize) .backgroundCol...
application-dev\reference\apis-arkui\arkui-ts\ts-explicit-animation.md
// xxx.ets @Entry @Component struct AnimateToExample { @State widthSize: number = 250 @State heightSize: number = 100 @State rotateAngle: number = 0 private flag: boolean = true build() { Column() { Button('change size') .width(this.widthSize) .height(this.heightSize) .margi...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-blocking-enhancement.md
// xxx.ets @Entry @Component struct FatherControlChild { scroller: Scroller = new Scroller() scroller2: Scroller = new Scroller() private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] private childRecognizer: GestureRecognizer = new GestureRecognizer() private currentRecognizer: GestureRecognizer = new Gestu...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-blocking-enhancement.md
// xxx.ets @Entry @Component struct Index { @State currentIndex: number = 0 @State selectedIndex: number = 0 @State fontColor: string = '#182431' @State selectedFontColor: string = '#007DFF' innerSelectedIndex: number = 0 // Record the index of the inner Tabs container. controller?: TabsController = new Tab...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-blocking-enhancement.md
// xxx.ets @Entry @Component struct Index { @State message: string = 'Gesture'; build() { Column() { Row({ space: 20 }) { Text(this.message) .width(400) .height(80) .fontSize(23) }.margin(25) } .margin(50) .width(400) .height(200) .borderWid...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-customize-judge.md
// xxx.ets @Entry @Component struct Index { @State message: string = ''; build() { Column() { Row({ space: 20 }) { Text(this.message).width(200).height(80).backgroundColor(Color.Pink) .fontSize(25) }.margin(20) } .width('100%') .height(200) .borderWidth(2) .onD...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-customize-judge.md
// xxx.ets import { promptAction } from '@kit.ArkUI'; @Entry @Component struct Index { scroller: Scroller = new Scroller() build() { Scroll(this.scroller) { Column({ space: 8 }) { Text("The upper red area is bound to the long press gesture, and the lower blue area is bound to a drag gesture. If ...
application-dev\reference\apis-arkui\arkui-ts\ts-gesture-settings.md
// xxx.ets @Entry @Component struct GestureSettingsExample { @State priorityTestValue: string = '' @State parallelTestValue: string = '' build() { Column() { Column() { Text('TapGesture:' + this.priorityTestValue).fontSize(28) .gesture( TapGesture() .onAction...
application-dev\reference\apis-arkui\arkui-ts\ts-keyframeAnimateTo.md
// xxx.ets import { UIContext } from '@kit.ArkUI'; @Entry @Component struct KeyframeDemo { @State myScale: number = 1.0; uiContext: UIContext | undefined = undefined; aboutToAppear() { this.uiContext = this.getUIContext?.(); } build() { Column() { Circle() .width(100) .height(...
application-dev\reference\apis-arkui\arkui-ts\ts-media-components-video.md
let controller: VideoController = new VideoController()
application-dev\reference\apis-arkui\arkui-ts\ts-media-components-video.md
// xxx.ets @Entry @Component struct VideoCreateComponent { @State videoSrc: Resource = $rawfile('video1.mp4') @State previewUri: Resource = $r('app.media.poster1') @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X @State isAutoPlay: boolean = false @State showControls: boolean = true @State...
application-dev\reference\apis-arkui\arkui-ts\ts-media-components-video.md
// xxx.ets @Entry @Component struct ImageAnalyzerExample { @State videoSrc: Resource = $rawfile('video1.mp4') @State previewUri: Resource = $r('app.media.poster1') @State showControls: boolean = true controller: VideoController = new VideoController() config: ImageAnalyzerConfig = { types: [ImageAnalyzerT...
application-dev\reference\apis-arkui\arkui-ts\ts-media-components-video.md
// xxx.ets import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData'; @Entry @Component struct Index { @State videoSrc: Resource | string = $rawfile('video1.mp4'); private controller: VideoController = new VideoController(); build() { Column() { Video({ src: this.videoSrc, ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-action-sheet.md
@Entry @Component struct ActionSheetExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Button('Click to Show ActionSheet') .onClick(() => { ActionSheet.show ({ // You are advised to use this.getUIContext().showAct...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-action-sheet.md
@Entry @Component struct ActionSheetExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Button('Click to Show ActionSheet') .onClick(() => { ActionSheet.show({ title: 'ActionSheet title', su...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-action-sheet.md
@Entry @Component struct ActionSheetExample { build() { Column({ space: 5 }) { Button('ActionSheet Set Duration') .onClick(() => { ActionSheet.show({ title: 'ActionSheet 1', message: 'Set Animation Duration open 3 second, close 100 ms', autoCance...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-action-sheet.md
@Entry @Component struct ActionSheetExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { Button('Click to Show ActionSheet') .onClick(() => { ActionSheet.show({ title: 'ActionSheet title', subtitle: 'ActionSheet subtitle', ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-action-sheet.md
@Entry @Component struct ActionSheetExample { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Button('Click to Show ActionSheet') .onClick(() => { ActionSheet.show ({ // You are advised to use this.getUIContext().showAct...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-alert-dialog-box.md
// xxx.ets @Entry @Component struct AlertDialogExample { build() { Column({ space: 5 }) { Button('one button dialog') .onClick(() => { // You are advised to use this.getUIContext().showAlertDialog(). AlertDialog.show( { title: 'title', mess...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-alert-dialog-box.md
// xxx.ets @Entry @Component struct AlertDialogExample { build() { Column({ space: 5 }) { Button('one button dialog') .onClick(() => { // You are advised to use this.getUIContext().showAlertDialog(). AlertDialog.show( { title: 'title', subt...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-alert-dialog-box.md
// xxx.ets @Entry @Component struct AlertDialogExample { build() { Column({ space: 5 }) { Button('AlertDialog Set Duration') .onClick(()=>{ // You are advised to use this.getUIContext().showAlertDialog(). AlertDialog.show( { title: 'AlertDialog 1...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-alert-dialog-box.md
// xxx.ets @Entry @Component struct AlertDialogExample { build() { Column({ space: 5 }) { Button('one button dialog') .onClick(() => { // You are advised to use this.getUIContext().showAlertDialog(). AlertDialog.show( { title: 'title', mess...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-alert-dialog-box.md
@Entry @Component struct AlertDialogExample { build() { Column({ space: 5 }) { Button('one button dialog') .onClick(() => { AlertDialog.show( { title: 'title', message: 'text', autoCancel: true, alignment: DialogAlignment....
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.md
// xxx.ets @Entry @Component struct CalendarPickerDialogExample { private selectedDate: Date = new Date('2024-04-23') build() { Column() { Button("Show CalendarPicker Dialog") .margin(20) .onClick(() => { console.info("CalendarDialog.show") CalendarPickerDialog.show({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.md
// xxx.ets @Entry @Component struct CalendarPickerDialogExample { private selectedDate: Date = new Date() build() { Column() { Button("Show CalendarPicker Dialog") .margin(20) .onClick(() => { console.info("CalendarDialog.show") CalendarPickerDialog.show({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.md
@Entry @Component struct CalendarPickerDialogExample { private selectedDate: Date = new Date('2024-04-23'); build() { Column() { Button("Show CalendarPicker Dialog") .margin(20) .onClick(() => { console.info("CalendarDialog.show") CalendarPickerDialog.show({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.md
// xxx.ets @Entry @Component struct CalendarPickerDialogExample { private selectedDate: Date = new Date('2024-04-23') build() { Column() { Button("Show CalendarPicker Dialog") .margin(20) .onClick(() => { console.info("CalendarDialog.show") CalendarPickerDialog.show({ ...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.md
// xxx.ets @Entry @Component struct CalendarPickerDialogExample { private selectedDate: Date = new Date('2025-01-01') private startDate: Date = new Date('2024-01-10') private endDate: Date = new Date('2025-1-10') build() { Column() { Text('Calendar date picker').fontSize(30) Button("Show Calend...
application-dev\reference\apis-arkui\arkui-ts\ts-methods-calendarpicker-dialog.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-methods-custom-dialog-box.md
dialogController : CustomDialogController | null = new CustomDialogController(CustomDialogControllerOptions)
application-dev\reference\apis-arkui\arkui-ts\ts-methods-custom-dialog-box.md
// xxx.ets @CustomDialog struct CustomDialogExampleTwo { controllerTwo?: CustomDialogController build() { Column() { Text('I'm the second dialog box') .fontSize(30) .height(100) Button('Close Second Dialog Box') .onClick(() => { if (this.controllerTwo != undefined) ...