EditText에대한 해결못한 몇가지질문
<EditText android:id="@+id/fileEdit" android:layout_width="200px" android:layout_height="wrap_content" android:editable="false" />
에서 런타임시 버튼이벤트에서 코딩으로 editable="true" 로만들려면 어떻게해야되나요?
그리고
인풋타입을 TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_URI 로설정했을때
키보드의 "다음" 키의 클릭이벤트를 받으려면 어떻게하면되나요?
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
// If the action is a key-up event on the return key, send the message
if (actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_UP) {
String str = view.getText().toString();
//이렇게하면 엔터키 이벤트를 받을수있는데
//엔터키대신 "다음" 키가있을경우 이벤트가 발생하지않는데
//어떻게해야 "다음" 키이벤트를 받을수있을까요?
}
return true;
}




기본적으로 여러개의 EditText가 있을 경우 위치를 파악하여 뒤에 또 EditText가 있으면 '다음' / 마지막이나 하나면 '엔터'로 나옵니다.
xml에서 EditText에서 바꾸실 수 있습니다.
android:imeOptions="actionNext"
옵션에 따라서 모양이 바뀝니다.
그래도 강제로 넣은 것이라면 그 옵션이 '다음' 이라고 해도 포커스가 넘어가지 않습니다.
java 코드에서 일부 수정을 하시면 될 것 같습니다.
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT) {\\DO}
return true;
}
});