我正在使用PHP通过Viber REST API创建一个Viber机器人。我试图了解如何创建Viber设置的键盘设计,但无济于事。如何使它看起来像Viber键盘设计所提供的示例一样?
[
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Smoking',
'BgColor' => '#f7bb3f',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/smoking.png',
],
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Non Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Non smoking',
'BgColor' => '#f6f7f9',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/no-smoking.png',
],
]
答案 0 :(得分:2)
Viber尝试拉伸较小的图像以填充按钮,并且尽管有多种方法可以控制哪个轴最大,以及是否裁剪了图像,但无法阻止这种拉伸。
您可以将每个按钮另存为高分辨率图像(包括文本和图标),然后将该图像用作按钮的“图像”属性的值。
或者,您可以放大当前图像的透明背景,以便总图像尺寸更大并可以填充按钮(例如100x100像素),而图标尺寸保持不变(24x24像素)。但是,这种方法的缺点是您需要找到如何在图像中放置图标,使其不与文本重叠。因此,通常建议使用包含文本和图标的高分辨率图像。