Reputation: 297
I saw many searchboxes in apps that if click the keyboard layout changes into Search button. How to change the android keyboard layout from Enter to Search if an EditText is click? Just like other search boxes. Thanks
Upvotes: 1
Views: 117
Reputation: 76
add
android:imeOptions="actionSearch"
to your EditText
in your layout file.
After that you can manage "search" click event by following code:
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
performSearch();
return true;
}
return false;
}
});
Upvotes: 1