设置数字输入型动作条到搜索查看 [英] set numeric input type to SearchView in ActionBar
问题描述
我不管理,设置数字输入型的搜索查看我的动作条。我有以下的 searchable.xml 文件在我的 RES / XML 文件夹:
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()));
该search_hint设置正确,但行机器人:inputType =号似乎没有任何效果,也就是数字键盘不会出现。
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?
推荐答案
添加这在searchable.xml布局文件:
Add this in your searchable.xml layout file:
android:numeric="decimal"
或如果没有用,然后尝试,
or If not useful then try,
安卓inputType =手机
和让我知道发生什么事。
And let me know what happen.
这篇关于设置数字输入型动作条到搜索查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!