I don't manage to set the numeric input type to the SearchView in my ActionBar. I have the following searchable.xml file in my res/xml folder:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:inputType="number"
android:label="@string/app_name"
android:hint="@string/search_hint">
</searchable>
And I set the searchable configuration to the SearchView as follows:
// Get the SearchView and set the searchable configuration
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
The search_hint is set correctly, but the line android:inputType="number" seems to have no effect, i.e. the numeric keypad doesn't appear.
Does anyone have a solution for this?
This should work :
Add this in your searchable.xml layout file:
or If not useful then try,
android:inputType="phone"
And let me know what happen.
try this