Android Keyboard "Go" to "Search"

can someone tell how to get “Search” instead of the “Go To” or “Finish” button on the Android keyboard. (not a magnifying glass).

+6
source share
4 answers

Try myEditText.setImeActionLabel("Search",EditorInfo.IME_ACTION_UNSPECIFIED) . IME_ACTION_UNSPECIFIED allows you to put any text you want into a button.

+12
source

something like that

 android:imeOptions="actionSearch" 

can work. in your case

there are other options, for example

 android:imeActionLabel="Search" 

EDIT

please check this topic. LINK

according to the link above, you get the full text only in landscape mode.

A full label is displayed only when there is a large amount of space for IME for it (for example, when the standard keyboard is in full screen mode).

so I assume that you can use android:imeOptions="actionSearch" , and the text Search will appear only in the landscape.

+16
source

Try the following:

  <EditText android:id="@+id/editTextSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:imeOptions="actionSearch" android:singleLine="true" > </EditText> 

Add "android: singleLine" to work properly

+4
source

Add the following two lines to your EditText tag:

  android:inputType="text" android:imeOptions="actionSearch" 

And add the setOnEditorActionListener () method to editText, as shown below:

  etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if(actionId == EditorInfo.IME_ACTION_SEARCH){ doSearch(); //Do whatever you intend to do when user click on search button in keyboard. } return true; } return false; } }); 
0
source

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


All Articles