本文整理匯總了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;
}