source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | // xxx.ets
@Entry
@Component
struct FlexExample2 {
build() {
Column() {
Column({ space: 5 }) {
Text('Wrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ wrap: FlexWrap.Wrap }) { // The child components are arranged in multiple lines.
Text('1').width('50%').height(50).backgro... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | // xxx.ets
@Component
struct JustifyContentFlex {
justifyContent : number = 0;
build() {
Flex({ justifyContent: this.justifyContent }) {
Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
Text('3').width('20%').height(50).ba... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | // xxx.ets
@Component
struct AlignItemsFlex {
alignItems : number = 0;
build() {
Flex({ alignItems: this.alignItems }) {
Text('1').width('33%').height(30).backgroundColor(0xF5DEB3)
Text('2').width('33%').height(40).backgroundColor(0xD2B48C)
Text('3').width('33%').height(50).backgroundColor(0x... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | // xxx.ets
@Component
struct AlignContentFlex {
alignContent: number = 0;
build() {
Flex({ wrap: FlexWrap.Wrap, alignContent: this.alignContent }) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').h... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | import {LengthMetrics} from '@kit.ArkUI';
@Entry
@Component
struct FlexExample2 {
build() {
Column() {
Column({ space: 5 }) {
Text('Wrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ wrap: FlexWrap.Wrap, space: {main: LengthMetrics.px(50), cross: LengthMetrics.px(50)} }) { // The ch... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-flex.md | @Component
struct Demo {
@Require @Prop text: string
build() {
Button() {
Flex() {
Image($r('sys.media.ohos_ic_public_voice'))
.width(16)
.height(16)
Row() {
Text(this.text)
.margin({
left: 6,
right: 6
})
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-folderstack.md | @Entry
@Component
struct Index {
@State len_wid: number = 480
@State w: string = "40%"
build() {
Column() {
// Set upperItems to IDs of the child components to be moved to the upper half screen in the hover state. Other components are stacked in the lower half screen.
FolderStack({ upperItems: ["... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-formlink.md | @Entry
@Component
struct FormLinkDemo {
build() {
Column() {
Text("This is a static widget").fontSize(20).margin(10)
// The router event is used to redirect to the specified UIAbility from the static widget.
FormLink({
action: "router",
abilityName: "EntryAbility",
param... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
@Entry
@Component
struct GridExample {
@State numbers1: String[] = ['0', '1', '2', '3', '4']
@State numbers2: String[] = ['0', '1','2','3','4','5']
layoutOptions3: GridLayoutOptions = {
regularSize: [1, 1],
onGetRectByIndex: (index: number) => {
if (index == 0)
return [0, 0, 1, 1... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
@Entry
@Component
struct GridExample {
@State numbers: String[] = ['0', '1', '2', '3', '4']
scroller: Scroller = new Scroller()
@State gridPosition: number = 0 // 0 indicates scrolling to the top of the grid, 1 indicates scrolling to the center, and 2 indicates scrolling to the bottom.
build() {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
@Entry
@Component
struct GridExample {
@State numbers: String[] = ['0', '1', '2', '3', '4']
scroller: Scroller = new Scroller()
layoutOptions1: GridLayoutOptions = {
regularSize: [1, 1], // Only [1, 1] is supported.
irregularIndexes: [0, 6], // The grid item whose indexes are 0 and 6 o... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | @Entry
@Component
struct GridExample {
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
@State numbers: number[] = []
@State translateY: number = 0
private scroller: Scroller = new Scroller()
private gridScroller: Scroller = new Scroller()
private touchDown: boolean = f... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | @Entry
@Component
struct GridExample {
@State numbers: string[] = []
scroller: Scroller = new Scroller()
@State text: string = 'drag'
@Builder pixelMapBuilder () { // Style for the drag event.
Column() {
Text(this.text)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width(80)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | @Entry
@Component
struct GridExample {
@State numbers: string[] = []
aboutToAppear() {
for (let i = 1; i <= 30; i++) {
this.numbers.push(i + '')
}
}
build() {
Scroll() {
Column({ space: 5 }) {
Blank()
Text('The layoutDirection, maxcount, minCount, and cellLength paramet... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
@Entry
@Component
struct GridExample {
@State numbers: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19']
@State columns: number = 2
aboutToAppear() {
let lastCount = AppStorage.get<number>('columnsCount')
if (typeof lastCo... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | @Entry
@Component
struct GridColumnsTemplate {
data: number[] = [0, 1, 2, 3, 4, 5]
data1: number[] = [0, 1, 2, 3, 4, 5]
data2: number[] = [0, 1, 2, 3, 4, 5]
build() {
Column({ space: 10 }) {
Text('auto-fill auto-calculates the number of columns based on the set column width').width('90%')
Grid(... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | @Entry
@Component
struct Index {
@State data: number[] = [];
@State items: number[] = [];
aboutToAppear(): void {
for (let i = 0; i < 100; i++) {
this.data.push(i)
this.items.push(this.getSize())
}
}
getSize() {
let ret = Math.floor(Math.random() * 5)
return Math.max(1, ret)
}
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
// This example demonstrates how to implement a Grid component with an edge fading effect and set the length of the fading edge.
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct GridExample {
@State numbers: String[] = ['0', '1', '2', '3', '4']
@State rowNumbers: String[] = ['0', '1', ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-grid.md | // xxx.ets
@Entry
@Component
struct GridExample {
@State numbers: String[] = ['0', '1', '2', '3', '4']
@State rowNumbers: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
scroller: Scroller = new Scroller()
build() {
Column({ space: 5 }) {
Grid(this.scroller) {
ForEach(this... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-gridcontainer.md | // xxx.ets
@Entry
@Component
struct GridContainerExample {
@State sizeType: SizeType = SizeType.XS
build() {
Column({ space: 5 }) {
GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6,... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-griditem.md | // xxx.ets
@Entry
@Component
struct GridItemExample {
@State numbers: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"]
build() {
Column() {
Grid() {
GridItem() {
Text('4')
.fontSize(16)
.backgroundColor(0xFAEEE0)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-griditem.md | // xxx.ets
@Entry
@Component
struct GridItemExample {
@State numbers: String[] = ['0', '1', '2']
build() {
Column({ space: 5 }) {
Grid() {
ForEach(this.numbers, (day: string) => {
ForEach(this.numbers, (day: string) => {
GridItem({style:GridItemStyle.NONE}) {
T... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-gridrow.md | // Enable the xs, sm, and md breakpoints.
breakpoints: {value: ["100vp", "200vp"]}
// Enable four breakpoints: xs, sm, md, and lg. The breakpoint range must be monotonically increasing.
breakpoints: {value: ["320vp", "600vp", "840vp"]}
// Enable five breakpoints: xs, sm, md, lg, and xl. The number of breakpoint... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-gridrow.md | // xxx.ets
@Entry
@Component
struct GridRowExample {
@State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]
@State currentBp: string = 'unknown'
build() {
Column() {
GridRow({
columns: 5,
gutter: { x: 5, y: 10 },
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-hyperlink.md | @Entry
@Component
struct HyperlinkExample {
build() {
Column() {
Column() {
Hyperlink('https://example.com/') {
Image($r('app.media.bg'))
.width(200)
.height(100)
}
}
Column() {
Hyperlink('https://example.com/', 'Go to the developer webs... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-isolated-component-sys.md | // OhCardWorker.ets
import { worker, ThreadWorkerGlobalScope, MessageEvents, ErrorEvent } from '@kit.ArkTS';
const workerPort: ThreadWorkerGlobalScope = worker.workerPort;
workerPort.onmessage = (e: MessageEvents) => {}
workerPort.onmessageerror = (e: MessageEvents) => {}
workerPort.onerror = (e: ErrorEvent)... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-isolated-component-sys.md | import { worker } from '@kit.ArkTS';
import { bundleManager } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
// Verify the .abc file and copy it to the specified sandbox path.
function VerifyAbc(abcPaths: Array<string>, deleteOriginalFiles: boolean) {
try {
bundleManag... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-isolated-component-sys.md | @Entry
@Component
struct Extension {
@State message: string = 'Hello World';
build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', ali... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item: number) => {
ListItem() {
Text('' + item)
.width('100%').height(100).fo... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListLanesExample {
@State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"]
@State alignListItem: ListItemAlign = ListItemAlign.Start
build() {
Column() {
List({ space: 20, initialIndex: 0 }... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListExample {
@State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State editFlag: boolean = false
build() {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item: number, index?: n... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListExample {
private arr: number[] = []
private scrollerForList: Scroller = new Scroller()
aboutToAppear() {
for (let i = 0; i < 20; i++) {
this.arr.push(i)
}
}
build() {
Column() {
Row() {
List({ space: 20, initialIndex: 3, scroller: this.... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListExample {
private arr: number[] = []
private scroller: ListScroller = new ListScroller()
@State listSpace: number = 10
@State listChildrenSize: ChildrenMainSize = new ChildrenMainSize(100)
aboutToAppear(){
// Initialize the data source.
for (let i = 0; i < 10; i... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListItemGroupExample {
private timeTable: TimeTable[] = [
{
title: 'Monday',
projects: ['Language', 'Math', 'English']
},
{
title: 'Tuesday',
projects: ['Physics', 'Chemistry', 'Biology']
},
{
title: 'Wednesday',
projects: ['H... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
scrollerForList: Scroller = new Scroller()
build() {
Column() {
List({ space: 20, initialIndex: 0, scroller: this.scrollerForList }) {
ForEach(this.ar... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-list.md | // xxx.ets
@Entry
@Component
struct ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
scrollerForList: Scroller = new Scroller()
build() {
Column() {
List({ space: 20, initialIndex: 0, scroller: this.scrollerForList }) {
ForEach(this.arr, (item: number) => {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitem.md | // xxx.ets
@Entry
@Component
struct ListItemExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item: number) => {
ListItem() {
Text('' + item)
.width('100%')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitem.md | // xxx.ets
@Entry
@Component
struct ListItemExample2 {
@State arr: number[] = [0, 1, 2, 3, 4]
@State enterEndDeleteAreaString: string = "not enterEndDeleteArea"
@State exitEndDeleteAreaString: string = "not exitEndDeleteArea"
private scroller: ListScroller = new ListScroller()
@Builder itemEnd() {
Row() ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitem.md | // xxx.ets
@Entry
@Component
struct ListItemExample3 {
build() {
Column() {
List({ space: "4vp", initialIndex: 0 }) {
ListItemGroup({ style: ListItemGroupStyle.CARD }) {
ForEach([ListItemStyle.CARD, ListItemStyle.CARD, ListItemStyle.NONE], (itemStyle: number, index?: number) => {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitem.md | // xxx.ets
import { ComponentContent } from '@kit.ArkUI';
class BuilderParams {
text: string | Resource;
scroller: ListScroller
constructor(text: string | Resource, scroller: ListScroller) {
this.text = text;
this.scroller = scroller;
}
}
@Builder
function itemBuilder(params: BuilderParams) {
Row() ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitemgroup.md | // xxx.ets
@Entry
@Component
struct ListItemGroupExample {
private timeTable: TimeTable[] = [
{
title: 'Monday',
projects: ['Language', 'Math', 'English']
},
{
title: 'Tuesday',
projects: ['Physics', 'Chemistry', 'Biology']
},
{
title: 'Wednesday',
projects: ['H... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitemgroup.md | // xxx.ets
@Entry
@Component
struct ListItemGroupExample2 {
private arr: ArrObject[] = [
{
style: ListItemGroupStyle.CARD,
itemStyles: [ListItemStyle.CARD, ListItemStyle.CARD, ListItemStyle.CARD]
},
{
style: ListItemGroupStyle.CARD,
itemStyles: [ListItemStyle.CARD, ListItemStyle.CA... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-listitemgroup.md | // xxx.ets
import { ComponentContent } from '@kit.ArkUI';
interface TimeTable {
title: string;
projects: string[];
}
class HeadBuilderParams {
text: string | Resource;
constructor(text: string | Resource) {
this.text = text;
}
}
class FootBuilderParams {
num: number | Resource;
constructor(num: num... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-navigator.md | // Navigator.ets
@Entry
@Component
struct NavigatorExample {
@State active: boolean = false
@State name: NameObject = { name: 'news' }
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Navigator({ target: 'pages/container/navigato... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-navigator.md | // Detail.ets
import { router } from '@kit.ArkUI'
@Entry
@Component
struct DetailExample {
// Receive the input parameters of Navigator.ets.
params: Record<string, NameObject> = router.getParams() as Record<string, NameObject>
@State name: NameObject = this.params.text
build() {
Flex({ direction: FlexDire... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-navigator.md | // Back.ets
@Entry
@Component
struct BackExample {
build() {
Column() {
Navigator({ target: 'pages/container/navigator/Navigator', type: NavigationType.Back }) {
Text('Return to Navigator Page').width('100%').textAlign(TextAlign.Center)
}
}.width('100%').height(200).padding({ left: 35, rig... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-panel.md | // xxx.ets
@Entry
@Component
struct PanelExample {
@State show: boolean = false
build() {
Column() {
Text('2021-09-30 Today Calendar: 1.afternoon......Click for details')
.width('90%')
.height(50)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
.padding({ left: 20 ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
@Entry
@Component
struct RefreshExample {
@State isRefreshing: boolean = false;
@State arr: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
build() {
Column() {
Refresh({ refreshing: $$this.isRefreshing }) {
List() {
ForEach(this.arr, (item: string) => ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
@Entry
@Component
struct RefreshExample {
@State isRefreshing: boolean = false;
@State promptText: string = "Refreshing...";
@State arr: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
build() {
Column() {
Refresh({ refreshing: $$this.isRefreshing, promptText: this.pro... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
@Entry
@Component
struct RefreshExample {
@State isRefreshing: boolean = false;
@State arr: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
@Builder
customRefreshComponent() {
Stack() {
Row() {
LoadingProgress().height(32)
Text("Refreshing...").fontSize... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
import { ComponentContent } from '@ohos.arkui.node';
class Params {
refreshStatus: RefreshStatus = RefreshStatus.Inactive;
constructor(refreshStatus: RefreshStatus) {
this.refreshStatus = refreshStatus;
}
}
@Builder
function customRefreshingContent(params: Params) {
Stack() {
Row() {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
import { ComponentContent } from '@ohos.arkui.node';
@Builder
function customRefreshingContent() {
Stack() {
Row() {
LoadingProgress().height(32)
}
.alignItems(VerticalAlign.Center)
}
.align(Alignment.Center)
.clip(true)
// Set a minimum height constraint to ensure that the heigh... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
@Entry
@Component
struct ListRefreshLoad {
@State arr: Array<number> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@State refreshing: boolean = false;
@State refreshOffset: number = 0;
@State refreshState: RefreshStatus = RefreshStatus.Inactive;
@State isLoading: boolean = false;
@Builder
refreshBuild... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-refresh.md | // xxx.ets
@Entry
@Component
struct RefreshExample {
@State isRefreshing: boolean = false
@State arr: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
build() {
Column() {
Refresh({ refreshing: $$this.isRefreshing }) {
List() {
ForEach(this.arr, (item: string) => {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.alignRules({
top: { anchor: "__container__", ali... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.alignRules({
top: { anchor: "__container__", ali... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.id("row1")
Row() {
Text('row2')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row()
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row()
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.alignRules({
left: { anchor: "guideline1", align: HorizontalAlign.End },
top: { anchor: "guideline2", a... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.id("row1")
Row() {
Text('row2')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(80)
.height(80)
.backgroundColor('#a3cf62')
.alignRules({
left: { anchor: "__container__", alig... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(80)
.height(80)
.backgroundColor('#a3cf62')
.alignRules({
left: { anchor: "__container__", alig... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.height(100)
.backgroundColor('#a3cf62')
.id("row1")
Row() {
Text('row2')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-relativecontainer.md | @Entry
@Component
struct Index {
build() {
Row() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(80)
.height(80)
.backgroundColor('#a3cf62')
.alignRules({
left: { anchor: "__container__", alig... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-row.md | // xxx.ets
@Entry
@Component
struct RowExample {
build() {
Column({ space: 5 }) {
// Set the horizontal spacing between two adjacent child components to 5.
Text('space').width('90%')
Row({ space: 5 }) {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').he... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-rowsplit.md | // xxx.ets
@Entry
@Component
struct RowSplitExample {
build() {
Column() {
Text('The second line can be dragged').fontSize(9).fontColor(0xCCCCCC).width('90%')
RowSplit() {
Text('1').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('10%').he... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | // xxx.ets
import { curves } from '@kit.ArkUI'
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
build() {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
ForEach(this.a... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct NestedScroll {
@State listPosition: number = 0; // 0 indicates scrolling to the top of the list, 1 indicates scrolling to the middle of the list, and 2 indicates scrolling to the bottom of the list.
private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8,... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | @Entry
@Component
struct StickyNestedScroll {
@State arr: number[] = []
@Styles
listCard() {
.backgroundColor(Color.White)
.height(72)
.width("100%")
.borderRadius(12)
}
build() {
Scroll() {
Column() {
Text("Scroll Area")
.width("100%")
.height("40%")
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | @Entry
@Component
struct NestedScroll {
private headerHeight: number = 0;
private arr: number[] = []
private scrollerForParent: Scroller = new Scroller()
private scrollerForChild: Scroller = new Scroller()
aboutToAppear(): void {
for (let i = 0; i < 10; i++) {
this.arr.push(i)
}
}
build() ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | @Entry
@Component
struct Index {
scroller: Scroller = new Scroller;
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
build() {
Scroll(this.scroller) {
Column() {
ForEach(this.arr, (item: number) => {
Text(item.toString())
.width('90%')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | // xxx.ets
@Entry
@Component
struct ListExample {
private arr: number[] = []
private scroller: ListScroller = new ListScroller()
@State listSpace: number = 10
@State listChildrenSize: ChildrenMainSize = new ChildrenMainSize(100)
@State listIndex: number = -1
@State mess:string = "null"
@State itemBackgrou... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | // xxx.ets
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
build() {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-scroll.md | // xxx.ets
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
build() {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
ForEach(this.arr, (item: number) => {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-sidebarcontainer.md | // xxx.ets
@Entry
@Component
struct SideBarContainerExample {
normalIcon: Resource = $r("app.media.icon")
selectedIcon: Resource = $r("app.media.icon")
@State arr: number[] = [1, 2, 3]
@State current: number = 1
build() {
SideBarContainer(SideBarContainerType.Embed) {
Column() {
ForEach(thi... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-stack.md | // xxx.ets
@Entry
@Component
struct StackExample {
build() {
Stack({ alignContent: Alignment.Bottom }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac)... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.md | let controller: SwiperController = new SwiperController() |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.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: DataChangeL... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.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: DataChangeL... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.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: DataChangeL... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.md | // xxx.ets
@Entry
@Component
struct SwiperCustomAnimationExample {
private DISPLAY_COUNT: number = 2
private MIN_SCALE: number = 0.75
@State backgroundColors: Color[] = [Color.Green, Color.Blue, Color.Yellow, Color.Pink, Color.Gray, Color.Orange]
@State opacityList: number[] = []
@State scaleList: number[] =... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.md | 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: DataChangeListener): v... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.md | // xxx.ets
import { BusinessError } from '@kit.BasicServicesKit'
@Entry
@Component
struct SwiperPreloadItems {
@State currentIndex: number = 1
private swiperController: SwiperController = new SwiperController()
@State arr: string[] = ["0", "1", "2", "3", "4", "5"]
build() {
Column() {
Swiper(this.sw... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.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: DataChangeL... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.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: DataChangeL... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-swiper.md | import { LengthMetrics } from '@kit.ArkUI'
// MyDataSource.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]
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabContentExample {
@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) {
Colum... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabContentExample {
@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) {
Colum... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabBarStyleExample {
build() {
Column({ space: 5 }) {
Text("Subtab style")
Column() {
Tabs({ barPosition: BarPosition.Start }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar(new Sub... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabsAttr {
private controller: TabsController = new TabsController()
@State indicatorColor: Color = Color.Blue;
@State indicatorWidth: number = 40;
@State indicatorHeight: number = 10;
@State indicatorBorderRadius: number = 5;
@State indicatorSpace: number = 10;
@State ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabsTextOverflow {
@State message: string = 'Hello World'
private controller: TabsController = new TabsController()
@State subTabOverflowOpaque: boolean = true;
build() {
Column() {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
Tab... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabContentExample6 {
private controller: TabsController = new TabsController()
@State text: string = "2"
@State tabPadding: number = 0;
@State symmetricExtensible: boolean = false;
@State layoutMode: LayoutMode = LayoutMode.VERTICAL;
@State verticalAlign: VerticalAlign = ... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
@Entry
@Component
struct TabBarStyleExample {
build() {
Column({ space: 5 }) {
Text("Subtab style")
Column() {
Tabs({ barPosition: BarPosition.Start }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar(new Sub... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
import { ComponentContent, UIContext } from "@kit.ArkUI";
class Params {
text: string = ""
constructor(text: string) {
this.text = text;
}
}
@Builder
function buildText(params: Params) {
Column() {
Text(params.text)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin(20)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
import { SymbolGlyphModifier } from '@kit.ArkUI';
@Entry
@Component
struct Index {
@State symbolModifier1: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_wifi'));
@State symbolModifier2: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ellipsis_bubble'));
@State symbolMo... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
import { ComponentContent, UIContext } from "@kit.ArkUI";
class Params {
text: string = ""
fontColor: string = ""
constructor(text: string, fontColor: string) {
this.text = text;
this.fontColor = fontColor;
}
}
@Builder
function buildText(params: Params) {
Column() {
Text(params.text... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabcontent.md | // xxx.ets
import { BusinessError } from '@kit.BasicServicesKit';
import { ComponentContent } from '@kit.ArkUI';
class Params {
text: string = ""
fontColor: string = ""
constructor(text: string, fontColor: string) {
this.text = text;
this.fontColor = fontColor;
}
}
@Component
struct imageCom {
buil... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md | // xxx.ets
@Entry
@Component
struct TabsExample {
@State text: string = 'Text';
@State barMode: BarMode = BarMode.Fixed;
build() {
Column() {
Row() {
Button('Add Text')
.width('47%')
.height(50)
.onClick((event?: ClickEvent) => {
this.text += 'Add Text'... |
application-dev\reference\apis-arkui\arkui-ts\ts-container-tabs.md | // xxx.ets
@Entry
@Component
struct TabsExample6 {
private controller: TabsController = new TabsController();
@State scrollMargin: number = 0;
@State layoutStyle: LayoutStyle = LayoutStyle.ALWAYS_CENTER;
@State text: string = 'Text';
build() {
Column() {
Row() {
Button('scrollMargin+10 ' + ... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.