• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RowSplit
2
3将子组件横向布局,并在每个子组件之间插入一根纵向的分割线。
4
5>  **说明:**
6>
7> 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
8
9## 子组件
10
11可以包含子组件。
12
13该组件会限制子组件的宽度。初始化时,该组件的布局是按照子组件的宽度来计算的。初始化后,后续动态修改子组件的宽度则不生效,使用的宽度为该组件分割线的间距,该宽度可以通过手势移动分割线进行变更。
14## 接口
15
16RowSplit()
17
18
19## 属性
20
21| 名称 | 参数类型 | 描述 |
22| -------- | -------- | -------- |
23| resizeable | boolean | 分割线是否可拖拽,默认为false。 |
24
25>  **说明:**
26>
27> RowSplit的分割线可以改变左右两边子组件的宽度,子组件可改变宽度的范围取决于子组件的最大最小宽度。
28>
29> 支持[clip](ts-universal-attributes-sharp-clipping)、[margin](ts-universal-attributes-size)等通用属性,clip不设置的时候默认值为true。
30
31
32## 示例
33
34```ts
35// xxx.ets
36@Entry
37@Component
38struct RowSplitExample {
39  build() {
40    Column() {
41      Text('The second line can be dragged').fontSize(9).fontColor(0xCCCCCC).width('90%')
42      RowSplit() {
43        Text('1').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
44        Text('2').width('10%').height(100).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
45        Text('3').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
46        Text('4').width('10%').height(100).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
47        Text('5').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
48      }
49      .resizeable(true) // 可拖动
50      .width('90%').height(100)
51    }.width('100%').margin({ top: 5 })
52  }
53}
54```
55
56![zh-cn_image_0000001219982729](figures/zh-cn_image_0000001219982729.gif)
57