简体   繁体   中英

Not getting “Go” button on android keyboard

Im using android:imeOptions="actionGo" for a edit text box. Its working properly on Android default keyboard. I'm getting "GO" button . But if i try to change the input method to either swype or LG keyboard on my LG device , I'm not getting "Go" instead im getting enter symbol. Why this is happening . I want Go button regardless of wt keyboard im using. Please can any one help me in this ?

Please add following two lines to your edittext:

<EditText
    android:singleLine="true"
    android:imeOptions="actionGo"/>

This will enable Go button on your softkeyboard

And to listen Go button Add

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if(actionId== EditorInfo.IME_ACTION_GO){
                //perfrom your action
            }
            return false;
        }
    });

Sadly not all manufacturer implements correctly their custom keyboard so you wont be able to have the "Go" button.

For instance, on HTC phones you won't get something else than a "enter button" even if you set a search action: android:imeOptions="actionSearch". On a Motorola Droid it works fine.

On some phones you have to set the imeOptions in java code to make it works. You can have a try on your LG.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM