本文整理汇总了Java中android.view.inputmethod.InputConnectionWrapper类的典型用法代码示例。如果您正苦于以下问题:Java InputConnectionWrapper类的具体用法?Java InputConnectionWrapper怎么用?Java InputConnectionWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InputConnectionWrapper类属于android.view.inputmethod包,在下文中一共展示了InputConnectionWrapper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInputConnection
import android.view.inputmethod.InputConnectionWrapper; //导入依赖的package包/类
public InputConnection createInputConnection(InputConnection base) {
return base == null ? null : new InputConnectionWrapper(base, true) {
@Override
public boolean sendKeyEvent(KeyEvent event) {
// TODO: this could be improved by working even when we are not empty.
// The behavior should be 'delete isLast character from mPre'.
// In that case, we should check also that getSelectionStart() == 0.
if (!isFirst() && mView.getText().length() == 0 &&
event.getAction() == KeyEvent.ACTION_DOWN &&
event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
removeFromChain(mView);
return false;
}
return super.sendKeyEvent(event);
}
};
}
示例2: getInputConnection
import android.view.inputmethod.InputConnectionWrapper; //导入依赖的package包/类
@VisibleForTesting
public InputConnectionWrapper getInputConnection() {
return mInputConnection;
}