我有问题从ActionBar SearchView(支持v7)设置建议列表的样式。
我需要设置哪种样式属性来更改背景和文字颜色?
拉尔夫
答案 0 :(得分:1)
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_menu, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
// Theme the SearchView's AutoCompleteTextView drop down. For some reason this wasn't working in styles.xml
SearchAutoComplete autoCompleteTextView = (SearchAutoComplete) searchView.findViewById(R.id.search_src_text);
if (autoCompleteTextView != null) {
autoCompleteTextView.setDropDownBackgroundResource(R.drawable.abc_search_dropdown_light);
}
}