【问题标题】:Adaptive card column sizing not working in bot framework c#自适应卡片列大小在 bot 框架 c# 中不起作用
【发布时间】:2019-09-28 01:32:14
【问题描述】:

我希望有 2 列,第一列的宽度为 20%,另一列的宽度为 80%,但似乎 size 属性未应用于 Microsoft Teams 自适应卡中的机器人框架 3.0。以下是我得到的响应,但它仍然被划分为 50-50% 大小的块。

  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "0.5",
  "body": [
    {
      "type": "ColumnSet",
      "columns": [
        {
          "type": "Column",
          "size": 1,
          "items": [
            { "type": "Image",
              "url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
              "size": "small",
              "style": "person"
            }
          ]
        },
        {
          "type": "Column",
          "width": 5,
          "items": [
            {
              "type": "TextBlock",
              "text": "Matt Hidinger",
              "weight": "bolder",
              "wrap": true
            },
            {
              "type": "TextBlock",
              "spacing": "none",
              "text": "Created {{DATE(2017-02-14T06:08:39Z, SHORT)}}",
              "isSubtle": true,
              "wrap": true
            }
          ]
        }
      ]
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Submit"
    }
  ]
} ```

【问题讨论】:

    标签: botframework microsoft-teams adaptive-cards


    【解决方案1】:

    第一列(错误地)使用了size 属性,但它应该是width

    这应该达到 20/80 的重量

    {
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.0",
        "body": [
            {
                "type": "ColumnSet",
                "columns": [
                    {
                        "type": "Column",
                        "width": 20,
                        "items": [
                            {
                                "type": "Image",
                                "url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
                                "size": "Small",
                                "style": "Person"
                            }
                        ]
                    },
                    {
                        "type": "Column",
                        "width": 80,
                        "items": [
                            {
                                "type": "TextBlock",
                                "text": "Matt Hidinger",
                                "weight": "Bolder",
                                "wrap": true
                            },
                            {
                                "type": "TextBlock",
                                "spacing": "None",
                                "text": "Created {{DATE(2017-02-14T06:08:39Z, SHORT)}}",
                                "isSubtle": true,
                                "wrap": true
                            }
                        ]
                    }
                ]
            }
        ],
        "actions": [
            {
                "type": "Action.Submit",
                "title": "Submit"
            }
        ]
    }
    

    【讨论】:

    • 我无法使用“宽度”属性,它给出的错误是“属性不存在”,我正在使用带有 Microsoft.AdaptiveCard v0.5 的机器人框架 3.0。
    • 您能否尝试将自适应卡版本更新到最新版本,看看是否有帮助?
    猜你喜欢
    • 2020-05-30
    • 2019-07-23
    • 2020-03-21
    • 1970-01-01
    • 1970-01-01
    • 2019-03-31
    • 2019-06-29
    • 2018-10-31
    • 2022-01-08
    相关资源
    最近更新 更多