我無法設置數字輸入類型爲我的ActionBar中的SearchView。我有以下searchable.xml文件在我RES/XML文件夾:在ActionBar中將數字輸入類型設置爲SearchView
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:inputType="number"
android:label="@string/app_name"
android:hint="@string/search_hint">
</searchable>
而且我設置了搜索配置到搜索查看如下:
// 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設置正確,但行android:inputType =「number」似乎沒有效果,即沒有出現數字小鍵盤。
有沒有人有解決方案?
通過使用自定義EditText上,而不是搜索查看的問題解決了。 –