子組件橫向布局

2024-01-22 17:56 更新

將子組件橫向布局,并在每個(gè)子組件之間插入一根縱向的分割線。

說明

該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標(biāo)單獨(dú)標(biāo)記該內(nèi)容的起始版本。

子組件

可以包含子組件

接口

RowSplit()

屬性

名稱

參數(shù)類型

描述

resizeable

boolean

分割線是否可拖拽,默認(rèn)為false。

說明

RowSplit的分割線最小能拖動到剛好包含子組件。

在真機(jī)中查看拖動效果,預(yù)覽器中不支持拖動。

不支持clip、margin通用屬性。

示例

  1. // xxx.ets
  2. @Entry
  3. @Component
  4. struct RowSplitExample {
  5. build() {
  6. Column() {
  7. Text('The second line can be dragged').fontSize(9).fontColor(0xCCCCCC).width('90%')
  8. RowSplit() {
  9. Text('1').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  10. Text('2').width('10%').height(100).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
  11. Text('3').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  12. Text('4').width('10%').height(100).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
  13. Text('5').width('10%').height(100).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  14. }
  15. .resizeable(true) // 可拖動
  16. .width('90%').height(100)
  17. }.width('100%').margin({ top: 5 })
  18. }
  19. }

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號