I want to take control of soft keyboard appering. So I have override EditText class and method onCheckIsTextEditor.
@Override
public boolean onCheckIsTextEditor() {
return MenuActivity.expanded;
}
And after it everything works fine except delete/backspace button. When I press it nothing change. Also when I set onClickListener to my editText i can see that every click except delete fire this listener.
public void setOnBackSpaceListener(){
this.setOnKeyListener((view, i, keyEvent) -> {
Log.d("AAA -> ", String.valueOf(keyEvent.getKeyCode()));
return false;
});
}
So it's look like android think there was no click and I don't know why?
I'm going to make the assumption that you are implementing View.OnKeyListener
in your Activity
or Fragment
. Are you passing your listener to the view you would like to capture the event from?
In this case, it will be:
mEditText.setOnKeyListener(this);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.