Can Android WebView HTML influence keyboard or keyboard features?

前端 未结 3 1788
粉色の甜心
粉色の甜心 2021-02-07 12:03

I have a webview with a credit card entry form (with standard fields). In different versions of Android I get different keyboards. Kit

3条回答
  •  青春惊慌失措
    2021-02-07 12:23

    Tried on Android Studio 3.0 (SDK API 26), the answer https://stackoverflow.com/a/23462658/3286489 crashes. After search further found this working.

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
        InputConnection inputConnection = new BaseInputConnection(this, true);
        outAttrs.imeOptions = outAttrs.imeOptions & ~EditorInfo.IME_FLAG_NAVIGATE_NEXT &
                ~EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS; 
        return inputConnection;
    }
    

    And

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
        InputConnection inputConnection = new BaseInputConnection(this, true);
        outAttrs.inputType = outAttrs.inputType | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
        return inputConnection;
    }
    

提交回复
热议问题