@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return new BaseInputConnection(this, true) {
@Override
public boolean finishComposingText() {
super.finishComposingText();
sendText(getEditable());
getEditable().clear();
return true;
}
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
super.commitText(text, newCursorPosition);
Editable content = getEditable();
sendText(content);
content.clear();
return true;
}
@Override
public boolean deleteSurroundingText(int leftLength, int rightLength) {
super.deleteSurroundingText(leftLength, rightLength);
}
}
}
字符串
我在我的自定义视图中使用了这段代码。它在Android上工作,但在wear os上不工作。在键盘上打字什么也不做。没有一个Base输入连接方法被调用。
我想像普通键盘一样输入,我不想使用远程输入。
PS:我正在使用Galaxy Watch 4(佩戴OS 4)
1条答案
按热度按时间nbewdwxp1#
字符串
设置此选项解决了问题