返回列表 發帖

新增代碼:
  1. public void delete(View view) {
  2.         //show.setText(show.getText().subSequence(0,show.getText().length()-1)); 字串切割法
  3.         if(show.getText().equals(""))  //防止空按錯誤
  4.         {
  5.             show.setText("");
  6.         }else {
  7.             st.pop();  //stak堆疊法
  8.             String output = "";
  9.             for (String str : st) {
  10.                 output += str;
  11.             }
  12.             show.setText(output);
  13.         }
  14.     }
  15.     Button.OnLongClickListener longClickListener = new View.OnLongClickListener() {
  16.         @Override
  17.         public boolean onLongClick(View v) {
  18.             show.setText("");
  19.             st.clear();
  20.             return true;
  21.         }
  22.     };
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

返回列表