首页 > 解决方案 > 如何在机器人框架中为 MS 团队垂直堆叠自适应卡片中的按钮

问题描述

我尝试使用列集,每列包含一个按钮,但 MS Teams 不会以首选格式呈现按钮,而 webchat 会。

在此处输入图像描述

在此处输入图像描述

此外,我尝试更改 MS Teams 中“MIS 报告”按钮的大小,以便所有按钮的大小相同,而与内容无关,但我发现自适应卡片中没有这样的属性。

标签: c#botframeworkbotsmicrosoft-teams

解决方案


您能否尝试在不同列集中的不同列中添加按钮?我已经尝试了下面的 json,它对我有用:

{
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                        {
                            "type": "ActionSet",
                            "actions": [
                                {
                                    "type": "Action.Submit",
                                    "title": "Action.Submit"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                        {
                            "type": "ActionSet",
                            "actions": [
                                {
                                    "type": "Action.Submit",
                                    "title": "Submit action 2"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                        {
                            "type": "ActionSet",
                            "actions": [
                                {
                                    "type": "Action.Submit",
                                    "title": "Submit action3"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}

这是屏幕截图: 在此处输入图像描述


推荐阅读