Hide the search / go button on the soft keyboard when using search. View?

I performed a search for my application. When I try to execute a query, I show the results using Listview and want to use one of them. If the list is missing, it will be empty. However, people can click the search icon / go to the soft keyboard, I want to hide this button.

I want the user to select values ​​only from sentences and not search separately

How can we achieve this?

+5
source share
1 answer

Just prevent the user from using the button whenever this value is not in your list. To do this, you can simply press the enter button.

@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: if(isTextInList()) return true; return false; default: return super.onKeyUp(keyCode, event); } } 

for more information: http://developer.android.com/training/keyboard-input/commands.html#SingleKey

+3
source

Source: https://habr.com/ru/post/1216081/


All Articles