我想知道的是我在运行时或在编辑文本中编写内容时所写的内容,或者只是想知道我在软键盘中单击了什么内容。
我使用了onKeUp方法,但只有在我按Enter或取消按钮时,它才起作用
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.keyCodeFromString():
if (event.isShiftPressed()) {
Log.i("sandeep","1");
} else {
Log.i("sandeep","2");
}
return true;
case KeyEvent.KEYCODE_K:
if (event.isShiftPressed()) {
Log.i("sandeep","3");
} else {
Log.i("sandeep","4");
}
return true;
default:
Log.i("sandeep","5");
return super.onKeyUp(keyCode, event);
}
}
答案 0 :(得分:2)
为此14
correct_answer
15
correct_answer2
16
correct_answer2
17
correct_answer
实施此addTextChangedListener
将此代码添加到您的EditText
或onCreate()
类的activity
中
fragment
这有助于您在运行时找出editText.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
//do your stuff here
}
@Override
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count) {
//do your stuff here
}
});
中已更改的文本
答案 1 :(得分:0)
我认为您正在寻找_tcpListener.ExclusiveAddressUse = false;
EditorActionListener