如何更改 Android searchview 边框颜色和 searchview 提示图标?
问问题
3995 次
2 回答
2
您必须使用反射来设置 SearchView 的样式。查看: http: //novoda.com/blog/styling-actionbar-searchview
于 2014-03-04T21:36:22.590 回答
0
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
// 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();
// Assumes current activity is the searchable activity
AutoCompleteTextView searchText = (AutoCompleteTextView)searchView.findViewById(R.id.abs__search_src_text);
searchText.setHintTextColor(getResources().getColor(R.color.white));
searchText.setTextColor(getResources().getColor(R.color.white));
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(false);
于 2014-01-22T13:27:16.063 回答