如何在Bot框架中为MS团队垂直堆叠自适应卡中的按钮

时间:2020-04-20 05:48:22

标签: c# botframework bots microsoft-teams

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

enter image description here

enter image description here

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

1 个答案:

答案 0 :(得分:2)

能否请您尝试将按钮添加到不同列集中的不同列中?我尝试了下面的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"
}

这是屏幕截图: enter image description here