简体   繁体   中英

Disable option on soft-keyboard android programmatically

I want to know that if possible disable hide option on a soft-keyboard programmatically.

Hide Option

//Disable return button
@Override
public boolean dispatchKeyEvent(KeyEvent event){

    if(event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_BACK:
                return true;
        }
    }

    return super.dispatchKeyEvent(event);
}

This code disable, as you can see, the return button. For your case you should replace KEYCODE_BACK with another constant . I don't know for sure if it is one for option button but you can check the list right here: https://developer.android.com/reference/android/view/KeyEvent.html

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