codecamp

将子组件纵向布局

将子组件纵向布局,并在每个子组件之间插入一根横向的分割线。

说明

该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。

子组件

可以包含子组件。

接口

ColumnSplit()

属性

名称

参数类型

描述

resizeable

boolean

分割线是否可拖拽,默认为false。

说明

与RowSplit相同,ColumnSplit的分割线最小能拖动到刚好包含子组件。

在真机中查看拖动效果,预览器中不支持拖动。

不支持clip、margin通用属性。

示例

  1. // xxx.ets
  2. @Entry
  3. @Component
  4. struct ColumnSplitExample {
  5. build() {
  6. Column(){
  7. Text('The secant line can be dragged').fontSize(9).fontColor(0xCCCCCC).width('90%')
  8. ColumnSplit() {
  9. Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  10. Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
  11. Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  12. Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
  13. Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
  14. }
  15. .borderWidth(1)
  16. .resizeable(true) // 可拖动
  17. .width('90%').height('60%')
  18. }.width('100%')
  19. }
  20. }

沿垂直方向布局的容器
计数器组件
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

媒体组件

像素

枚举

类型

接口

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }