Invoking Search Button in Keyboard While Typing in EditText in Android
EditText can sometimes be a way of communicating with applications. Generally, EditTexts are used to fill in information or queries by the user and execute some tasks. Once the text is typed, the information or the query can be passed in the background to make things available or do some operations. But to pass it, there should be some method like if the user stops typing, accept the typed text, or use a button instead to pass the info.
This is quite similar to a Search Bar. A Search Bar originally is an application of EditText, where users can type something and click the search button on the screen or from the invoked keyboard. By nature, the invoked keyboard does not come with a search button. A developer has to program it in such a way that a search icon appears on the invoked keyboard.
So through this article, we will show you how you should configure your EditText such that you are able to show the Search Icon along with other options available in Android.
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.
Step 2: Create EditText element in the activity_main.xml (Layout file)
While creating one, remember to put these configuration tags.
Check the code below:
Now run the application and start typing in the edit text, or simply click on it once. Keyboard gets invoked and you can see the search option at the bottom.
Similarly, we have the following options in Android to replace the existing one:
Please Login to comment...