『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 729|回复: 2

[UI界面] layout-card 尺寸如何调整

[复制链接]

1

主题

7

帖子

58

积分

注册会员

Rank: 2

积分
58
金钱
51
HASS币
0
发表于 2023-12-18 23:19:16 | 显示全部楼层 |阅读模式
我现在做完了一个净化器的弹出卡片,但是不管是是在手机侧还是电脑侧,显示效果都要重叠的部分,怎么可以调整下宽度和高度的比例让它完美显示呢?
代码如下:
type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: picture
        image: /local/jinghuaqi.jpg
        theme: ios-dark-mode
        tap_action:
          action: none
        hold_action:
          action: none
      - type: custom:layout-card
        layout_type: custom:grid-layout
        cards:
          - type: custom:mushroom-entity-card
            entity: switch.zhimi_va1_276f_switch_status
            name: 电源
            icon_color: purple
            primary_info: name
            secondary_info: state
            icon_type: entity-picture
            tap_action:
              action: toggle
            hold_action:
              action: none
          - type: custom:mushroom-entity-card
            entity: fan.kong_qi_jing_hua_qi
            icon_color: green
            primary_info: name
            secondary_info: state
            name: 状态
            tap_action:
              action: toggle
            hold_action:
              action: none
            double_tap_action:
              action: none
      - type: custom:layout-card
        layout_type: custom:grid-layout
        layout: {}
        cards:
          - type: custom:mushroom-entity-card
            entity: switch.kong_qi_jing_hua_qi_child_lock
            name: 儿童锁
            icon: mdi:lock
            icon_color: orange
            primary_info: name
            secondary_info: state
            icon_type: entity-picture
            hold_action:
              action: toggle
            double_tap_action:
              action: none
            tap_action:
              action: none
          - type: custom:mushroom-entity-card
            entity: sensor.kong_qi_jing_hua_qi_motor_speed
            icon: mdi:speedometer
            icon_color: teal
            primary_info: name
            secondary_info: state
            icon_type: entity-picture
            tap_action:
              action: more-info
            hold_action:
              action: none
            double_tap_action:
              action: none
            name: 转速
  - type: horizontal-stack
    cards:
      - type: vertical-stack
        cards:
          - type: custom:layout-card
            layout_type: custom:grid-layout
            layout: {}
            cards:
              - type: custom:mushroom-entity-card
                entity: number.kong_qi_jing_hua_qi_fan_level
                icon: mdi:speedometer
                icon_color: green
                primary_info: name
                secondary_info: state
                icon_type: entity-picture
                tap_action:
                  action: call-service
                  service: fan.increase_speed
                  target:
                    entity_id: []
                    device_id:
                      - 1decf51fdbb7c6ae6177ecf65c09a2bb
                    area_id: []
                  data:
                    percentage_step: 30
                hold_action:
                  action: more-info
                double_tap_action:
                  action: none
                name: 升档
              - type: custom:mushroom-entity-card
                entity: number.kong_qi_jing_hua_qi_fan_level
                name: 降档
                icon_color: light-green
                primary_info: name
                secondary_info: state
                icon_type: entity-picture
                tap_action:
                  action: call-service
                  service: fan.decrease_speed
                  target:
                    area_id: []
                  data:
                    percentage_step: 30
                hold_action:
                  action: more-info
                double_tap_action:
                  action: none
                icon: mdi:speedometer-slow
      - type: custom:layout-card
        layout_type: custom:grid-layout
        layout: {}
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.zhimi_va1_276f_temperature
            name: 温度
            icon_color: red
            primary_info: name
            background: green
            secondary_info: state
            tap_action:
              action: more-info
            hold_action:
              action: none
            double_tap_action:
              action: none
          - type: custom:layout-card
            layout_type: custom:grid-layout
            layout: {}
            cards:
              - type: custom:mushroom-entity-card
                entity: sensor.zhimi_va1_276f_relative_humidity
                name: 湿度
                icon_color: teal
                primary_info: name
                secondary_info: state
                tap_action:
                  action: more-info
                hold_action:
                  action: none
                double_tap_action:
                  action: none
      - type: custom:layout-card
        layout_type: custom:grid-layout
        layout: {}
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.zhimi_va1_276f_filter_used_time
            name: 使用时长
            icon_color: purple
            primary_info: name
            secondary_info: state
            tap_action:
              action: more-info
            hold_action:
              action: none
            double_tap_action:
              action: none
          - type: custom:layout-card
            layout_type: custom:grid-layout
            layout:
              layout: {}
            cards:
              - type: custom:mushroom-entity-card
                entity: sensor.kong_qi_jing_hua_qi_filter_lifetime_remaining
                name: 滤芯
                icon_color: green
                primary_info: name
                secondary_info: state
                tap_action:
                  action: more-info
                hold_action:
                  action: none
                double_tap_action:
                  action: none
      - type: horizontal-stack
        cards:
          - type: custom:layout-card
            layout_type: custom:grid-layout
            cards:
              - type: custom:mushroom-entity-card
                entity: light.zhimi_va1_276f_indicator_light
                icon_color: light-green
                primary_info: name
                secondary_info: state
                icon_type: entity-picture
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
                double_tap_action:
                  action: none
                name: 指示灯
              - type: custom:mushroom-entity-card
                entity: sensor.kong_qi_jing_hua_qi_pm2_5
                name: PM2.5
                icon: ''
                icon_color: pink
                primary_info: name
                secondary_info: state
                icon_type: entity-picture
                tap_action:
                  action: more-info
                hold_action:
                  action: none
                double_tap_action:
                  action: none
            layout: {}


回复

使用道具 举报

1

主题

7

帖子

58

积分

注册会员

Rank: 2

积分
58
金钱
51
HASS币
0
 楼主| 发表于 2023-12-18 23:22:14 | 显示全部楼层
实际效果见图
89.jpg
90.png
回复

使用道具 举报

7

主题

49

帖子

453

积分

中级会员

Rank: 3Rank: 3

积分
453
金钱
404
HASS币
0
发表于 2023-12-19 22:59:07 来自手机 | 显示全部楼层
学习学习
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-12 07:27 , Processed in 0.051154 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表