显示没有按钮的文本

时间:2016-06-23 15:27:05

标签: java android

我正在尝试显示用户在Android应用上输入的一些文字。但是,我在网上找到的所有示例都要求您在显示某些文本之前按一个按钮。是否可以在没有按钮的情况下显示用户输入?

2 个答案:

答案 0 :(得分:2)

就像提到的@ligi一样,你可以像这样使用TextWatcher:

function PODTool() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  SpreadsheetApp.setActiveSheet(spreadsheet.getSheets()[0]);

  var sheet = spreadsheet.getActiveSheet();
  var lastRow = sheet.getLastRow();

  var startRow = 2;

  var range = sheet.getRange(2,7,lastRow-startRow+1,1 );
  var numRows = range.getNumRows();
  var LinksToPODForm = range.getValues();

  var rangeColumnReadyToSendEmail =sheet.getRange(2,9,lastRow-startRow+1,1);
  var sendEmailOrNot = rangeColumnReadyToSendEmail.getValues();


  var warning_count = 0;
  var msg = "";

  // Loop over the values 
  for (var i = 0; i <= numRows - 1; i++) {
    var EachLinkValue = LinksToPODForm[i][0];


    if (EachSendEmailOrNotValue=="yes" && sheet.getRange(i+2,10).getValue()=='Email not Sent' &&EachEmailRecipient=="Someone"){
    var BillingOfLadingShowingInEmailNotification = Billing_of_lading_number[i][0];


    msg = msg +"Requester:       "+EachEmailRecipient+"
    warning_count++;
    var subject ="Billing of Lading: "+BillingOfLadingShowingInEmailNotification;
      sheet.getRange(i+2,10).setValue('Sent');
    var recipient = "xxx@gmail.com";
  }

  if(warning_count) {
    MailApp.sendEmail(recipient, subject,msg)
  }

};

答案 1 :(得分:1)

您可以将TextWatcher添加到EditText