This is an Android keyboard source question. This is a keyboard display question that fits the input type.

Asked 2 years ago, Updated 2 years ago, 137 views

This is an Android keyboard source question. This is a keyboard display question that fits the input type.

It is currently being tested with a keyboard source.

If you log in on the website, you can see the English keyboard when you click on the ID and password Other than that, I'm trying to get a Korean keyboard.

If the input type is password or ID input box (I wonder if I can check that it is ID input box) I would like to know how to extract the property of the type from Android. (Simple sample request) (Or I wonder if it's right to check like this. )

Also, if you click on the address bar, you want to see an English keyboard that is different from when you click on the ID column. (Www or .com, etc.) )

I don't know how to check this part as above.

I heard that the keyboard is working normally now. Basically, the Korean keyboard is set to come up.

I checked that it works well on the Samsung keyboard, which is the basic keyboard, and I am trying to implement it in the same way.

Please understand even if it is a vague and somewhat random question. Please give me warm advice.

That's it.

Thank you.

keyboard

2022-09-21 20:50

1 Answers

I thought the intention of the question was below, so I left an answer. (If you misunderstood, please let me know.)

I'm implementing the keyboard myself, and depending on the input type, I want to show you the layout of the keyboard differently, but how do I handle it?

On Android, the keyboard implementation begins with inheriting the InputMethodService class, which covers the life cycle of the keyboard. Pass the EditorInfo object as a parameter when the onStartInput(), onStartInputView() functions of this class are called. This object lets you get inputType information for the current EditText.

The following code lets you see how inputType is imported from the EditorInfo object. The code is long, so I copied only the relevant part. Full code can be found here at

@Override
public void onStartInputView(final EditorInfo attribute,
                         final boolean restarting) {

    ...

    switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
        case EditorInfo.TYPE_CLASS_DATETIME:
            mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_DATETIME,
                    attribute, restarting);
            break;
        case EditorInfo.TYPE_CLASS_NUMBER:
            mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_NUMBERS,
                    attribute, restarting);
            break;
        case EditorInfo.TYPE_CLASS_PHONE:
            mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_PHONE,
                    attribute, restarting);
            break;
        case EditorInfo.TYPE_CLASS_TEXT:
            final int variation = attribute.inputType& EditorInfo.TYPE_MASK_VARIATION;
            switch (variation) {
                case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD:
                case EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD:
                case 0xe0:// API 11 EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD:
                    mPredictionOn = false;
                    break;
                default:
                    mPredictionOn = true;
            }
        }

    ...
}

And there's a sample of the Android keyboard provided by Google. I think it would be helpful to get the code and run it yourself.

In the sample above, the part that deals with inputType is line 166 of the link below.

Also, please refer to the official Android document, Creating an Input Method. If you search for 'Handling different input types' in this document, it will cover the relevant content.

Refer to the 'Candidates view' section in the above document for information on displaying auxiliary keywords such as 'www' and 'com' on the keyboard.


2022-09-21 20:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.