0

edittext に文字を入力し、edittext の長さが 3 より大きい場合は、ブラケットを維持する必要があります。

誰かがこれをした場合は、私に知らせてください。

前もって感謝します

トラプチ

4

1 に答える 1

0

EditText フィールドに文字が入力または削除されるたびに呼び出される EditText の TextWatcher を登録できます。

EditText editText = (EditText) findViewById(R.id.edit_text_field_id);
editText.addTextChangedListener(new TextWatcher() {

        @Override 
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
          // This method is called to notify you that, within s, the count characters 
          // beginning at start are about to be replaced by new text with length after.  
        }

        @Override 
        public void onTextChanged(CharSequence s, int start, int before, int count) {
          // This method is called to notify you that, within s, the count characters 
          // beginning at start have just replaced old text that had length before.
        }

        @Override 
        public void afterTextChanged(Editable s) {
          // This method is called to notify you that, somewhere within s, the text has 
          // been changed.
        }
      });

詳細については、 TextWatcherのドキュメントを参照してください。

于 2012-08-18T10:30:59.003 に答える