简体   繁体   English

调整 Viber bot 中按钮的高度

[英]Adjust heigh for buttons in Viber bot

I need to display buttons in Viber bot using rich_media message type and Viber REST API.我需要使用rich_media消息类型和 Viber REST API 在 Viber 机器人中显示按钮。 When buttons are rendered the Rich Media element has a fixed height (see on screenshot).呈现按钮时,富媒体元素具有固定高度(参见屏幕截图)。 If there is five buttons in Rich Media element some empty place appear under the last button.如果 Rich Media 元素中有五个按钮,则最后一个按钮下方会出现一些空白位置。 在此处输入图像描述

My source sode for rendering buttons:我用于渲染按钮的源代码:


var reply = {
    type: "raw",
    method: "send_message",
    body: {
        receiver: $request.data.chatId,
        sender:{
            name: "John McClane",
            avatar: "http://avatar.example.com"
        },
        min_api_version: 2,
        type: "rich_media",
        rich_media: {
            Type: "rich_media",
            Buttons: [
                {
                    Rows: 1,
                    ActionBody: "Option 1",
                    ActionType: "reply",
                    Text: "Option 1"
                },
                {
                    Rows: 1,
                    ActionBody: "Option 2",
                    ActionType: "reply",
                    Text: "Option 2"
                },
                {
                    Rows: 1,
                    ActionBody: "Option 3",
                    ActionType: "reply",
                    Text: "Option 3"
                },
                ...
            ]
        }
    }
}

I need to adjust the height of Rich Media element so the element stretches depending on the number of buttons.我需要调整 Rich Media 元素的高度,以便元素根据按钮的数量进行拉伸。 Is there a way to set height or disable default height of Rich Media element?有没有办法设置高度或禁用富媒体元素的默认高度?

Found the solution by myself.自己找到了解决方案。 There is a parameter called ButtonsGroupRows (rich_media.ButtonsGroupRows, docs on this parameter).有一个名为 ButtonsGroupRows 的参数(rich_media.ButtonsGroupRows,有关此参数的文档)。 7 is default value. 7 是默认值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使GridLayout中的按钮自动调整 - Make Buttons in GridLayout auto adjust 我们可以在Android中调整按钮的边框吗? - Can we adjust the borders of buttons in Android? Microsoft Bot Framework:按钮在Facebook频道上不起作用 - Microsoft Bot Framework: buttons not working on facebook channel Microsoft Bot Framework WebChat:禁用AdaptiveCards提交上一条消息的按钮 - Microsoft Bot Framework WebChat: Disable AdaptiveCards submit buttons of previous message 使用 discord.py 和 DiscordComponents bot 与 Discord 按钮交互失败? - Interaction failed with Discord buttons using discord.py and DiscordComponents bot? 我希望我的JFrame调整其尺寸并使按钮保持恒定大小 - I want my JFrame to adjust its dimensions and keep the buttons with constant size 动态添加7个按钮,以在Android中将所有屏幕尺寸调整为宽度和高度 - Add 7 buttons dynamically to adjust all the screen sizes to it's width and height in Android 有没有办法调整 UITabBar 按钮项的宽度以适应屏幕上超过 5 个按钮? - Is there a way to adjust the width of UITabBar button items to fit more than 5 buttons on the screen? 如何使用 c# 在电报机器人中使用斜杠命令列表而不是键盘按钮? - How can i do slash command list instead keyboard buttons in telegram bot using c#? 如何使用 discord-buttons npm 包为我的机器人制作票务系统? - How do I make a ticketing system for my bot using the discord-buttons npm package?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM