How to create this UI in Gmail Add-on using Google Apps Script

点点圈 提交于 2019-12-10 11:43:52

问题


Can someone tell me how to achieve below UI in Gmail Add-on using Google Apps Script? I tried KeyValue for the icon with text which is clickable and I am able to achieve that but I don't know how to put email text, next to the keyValue icon. Right now, I don't care about the position of the icon with counter and email text, I want them in the same row doesn't matter left or right. This is my code which is just showing icon with counter on the left side but not able to add email text anywhere.

var card = CardService.newCardBuilder()
.setHeader(
  CardService.newCardHeader()
    .setTitle('some Title')
);

 var section = CardService.newCardSection();

 var keyValue = CardService.newKeyValue()
  .setContent(getNumberOfPosts())
  .setIconUrl('https://ayz.png')
  .setOnClickAction(action);

 section.addWidget(keyValue);
 card.addSection(section);


回答1:


Take a look at this screenshot

I used an emoji for the eye (Add-on support emojis). Does this get you what you are looking for?

          settingSection.addWidget(CardService.newKeyValue()
                                      .setContent("User@email.com")
                                      .setOnClickAction(saveAction)
                                      .setButton(CardService.newTextButton()
                                                 .setText("👁️ 2")
                                                 .setOnClickAction(saveAction))
                                       );


来源:https://stackoverflow.com/questions/51018013/how-to-create-this-ui-in-gmail-add-on-using-google-apps-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!