如何更改Android searchview边框颜色和searchview提示图标?
答案 0 :(得分:2)
您必须使用反射来设置SearchView的样式。查看:http://novoda.com/blog/styling-actionbar-searchview
答案 1 :(得分: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);