inputType : 입력 받을 데이터의 형태를 설정한다.
hint : 안내 문구를 설정한다.
text : 처음 보여질 때 나타날 문자열을 설정한다.
imeOptions : 키보드 엔터 키의 형태를 설정한다.
setText : EditText에 문자열을 설정한다.
getText : EditText에 입력한 문자열을 가져온다.
OnEditorActionListener : 엔터 키를 누르면 반응하는 리스너
class EnterListener implements TextView.OnEditorActionListener{
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
String str = v.getText().toString();
textView.setText("입력한 문자열 : "+ str);
return false;
}
}
TextWatcher : 입력을 할 때마다 반응하는 리스너
class WathcherClass implements TextWatcher{
@Override
//문자열 값이 변경 되었을 때
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
textView.setText("문자열 변경 중 : " + s);
}
@Override
//문자열 값이 변경되기 전
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
//문자열 값이 변경된 이후
public void afterTextChanged(Editable s) {
}
}