사용자 입력에 사용하는 에디트 텍스트 ( 텍스트 입력 박스 )
In this section, you will create a text field for user input, using the
텍스트입력 박스에서 Enter Key 를 누르면 메시지 출력하기....^^
Once text has been entered into the field, the "Enter" key will display the text in a toast message.
In this section, you will create a text field for user input, using the
EditText
widget. 텍스트입력 박스에서 Enter Key 를 누르면 메시지 출력하기....^^
Once text has been entered into the field, the "Enter" key will display the text in a toast message.
final EditText edittext = (EditText) findViewById(R.id.edittext); edittext.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on key press Toast.makeText(HelloFormStuff.this, edittext.getText(), Toast.LENGTH_SHORT).show(); return true; } return false; } });
'0.일반개발' 카테고리의 다른 글
EditText (0) | 2010.09.15 |
---|---|
EditText (0) | 2010.09.15 |
다이얼로그 생성 (0) | 2010.09.15 |
showKeypad (0) | 2010.09.15 |
이동, 회전, 크기 등의 속성을 변경 (0) | 2010.09.15 |