[英]Disable option on soft-keyboard android programmatically
I want to know that if possible disable hide option on a soft-keyboard programmatically. 我想知道,如果可能,请以编程方式禁用软键盘上的隐藏选项。
//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 . 对于您的情况,应将KEYCODE_BACK替换为另一个常量 。 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 我不确定它是否为选项按钮之一,但您可以在此处查看列表: https : //developer.android.com/reference/android/view/KeyEvent.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.