【问题标题】:Google app script,gmail addon align action center and styling of TextInputGoogle 应用脚本、gmail 插件对齐操作中心和 TextInput 的样式
【发布时间】:2018-02-23 16:05:03
【问题描述】:

我已经使用谷歌脚本创建了简单的 gmail 插件,因为我在这里遇到了困难,

我用的是简单的卡片,问题是,我们需要在卡片的中心对齐动作按钮并将css样式应用于TextInput

我参考了文档,但没有找到任何方法

下面的代码我试过了,

var card = CardService.newCardBuilder();
  card.setHeader(CardService.newCardHeader().setTitle("Login Here"));
  var section = CardService.newCardSection()
  var cleint_id_Input = CardService.newTextInput()
     .setFieldName("client_id")
     .setTitle("Please enter clinet id")
  var username_Input = CardService.newTextInput()
     .setFieldName("username")
     .setTitle("Please enter username")
  var password_Input = CardService.newTextInput()
     .setFieldName("password")
     .setTitle("Please enter password")
  section.addWidget(cleint_id_Input)
  section.addWidget(username_Input)
  section.addWidget(password_Input)
  Logger.log("Input Value%s",cleint_id_Input)
  //Login action button
  var action = CardService.newAction().setFunctionName('loginCallback');
  section.addWidget(CardService.newTextButton().setText('Login').setOnClickAction(action))  
  card.addSection(section)

提前致谢

【问题讨论】:

标签: css google-apps-script gmail-addons


【解决方案1】:

到目前为止,gmail 插件不支持输入小部件的完整样式。但是有一种方法可以对小部件进行少量格式化。更多信息请通过:https://developers.google.com/gmail/add-ons/concepts/widgets.

要将按钮水平居中对齐,您可以使用以下技巧:

var whitespaces = "                        ";

section.addWidget(CardService.newTextButton().setText(whitespaces + "button" + whitespaces).setOnClickAction(action));

【讨论】:

  • 非常有帮助。 !
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-04
  • 1970-01-01
  • 2021-12-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多