• 鸿蒙入门12-Divider


    分割器组件,分割不同内容快/内容元素

    参数

    属性

    名称

    参数类型

    默认值

    描述

    vertical

    boolean

    false

    使用水平分割线还是垂直分割线

    false : 水平分割线

    true : 垂直分割线

    color

    ResourceColor

    -

    设置分割线颜色

    strokeWidth

    number | string

    1

    设置分割线宽度

    lineCap

    LineCapStyle

    LineCapStyle.Butt

    设置分割线的端点样式

    LineCapStyle

    名称

    描述

    Butt

    分割线两端为 无端点

    Round

    分割线两端为 圆角端点

    Square

    分割线两端为 直角端点

    事件

    • 不支持通用事件

    示例 1

    1. @Entry
    2. @Component
    3. struct Index {
    4. @State values: number[] = [ 10, 20, 30, 40, 50, 60, 70, 80, 90 ]
    5. build() {
    6. Column() {
    7. Text('文本内容')
    8. Divider().strokeWidth(10).lineCap(LineCapStyle.Butt)
    9. Text('文本内容')
    10. Divider().strokeWidth(10).lineCap(LineCapStyle.Round)
    11. Text('文本内容')
    12. Divider().strokeWidth(10).lineCap(LineCapStyle.Square)
    13. Text('文本内容')
    14. }.padding(50)
    15. }
    16. }

     示例 2

    1. @Entry
    2. @Component
    3. struct Index {
    4. @State values: number[] = [ 10, 20, 30, 40, 50, 60, 70, 80, 90 ]
    5. build() {
    6. Column() {
    7. Text('文本内容')
    8. Divider().strokeWidth(10).lineCap(LineCapStyle.Butt)
    9. Text('文本内容')
    10. Divider().strokeWidth(10).lineCap(LineCapStyle.Round)
    11. Text('文本内容')
    12. Divider().strokeWidth(10).lineCap(LineCapStyle.Square)
    13. Text('文本内容')
    14. Row() {
    15. Text('文本')
    16. Divider().strokeWidth(10).vertical(true)
    17. Text('文本')
    18. Divider().strokeWidth(10).vertical(true)
    19. Text('文本')
    20. Divider().strokeWidth(10).vertical(true)
    21. Text('文本')
    22. }.height(50)
    23. }.padding(50)
    24. }
    25. }

     示例 3

    1. @Entry
    2. @Component
    3. struct Index {
    4. @State values: number[] = [ 10, 20, 30, 40, 50, 60, 70, 80, 90 ]
    5. build() {
    6. Column() {
    7. Text('文本内容')
    8. Divider().strokeWidth(10).lineCap(LineCapStyle.Butt).color(Color.Pink)
    9. Text('文本内容')
    10. Divider().strokeWidth(10).lineCap(LineCapStyle.Round).color(Color.Brown)
    11. Text('文本内容')
    12. Divider().strokeWidth(10).lineCap(LineCapStyle.Square).color(Color.Orange)
    13. Text('文本内容')
    14. }.padding(50)
    15. }
    16. }

     

  • 相关阅读:
    Unreal Engine 4 + miniconda + Python2.7 + Pycharm
    腾讯mini项目-【指标监控服务重构】2023-08-19
    ffmpeg基础五:单独解码裸流aac或MP3或H264
    持续集成指南:GitLab 的 CI/CD 工具配置与使用
    前端面经 前端优化
    WINUI——Trigger(触发器)使用小结
    C语言深度剖析——bool类型,浮点数相等比较。
    Ceph入门到精通-网络调优netstat -s
    2022年华数杯资料汇总
    Spring之Bean的初始化和销毁
  • 原文地址:https://blog.csdn.net/qq_42660453/article/details/138181172