这里要针对2种searchview进行操作,
通常的
- SearchView
SearchView mSearchViewInclude;
int id =mSearchViewInclude.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);
v7包里的:
- android.support.v7.widget.SearchView
SearchView.SearchAutoComplete textView = (SearchView.SearchAutoComplete)mSearchViewInclude.findViewById(R.id.search_src_text);
textView.setTextColor(getResources().getColor(R.color.text_color_normal));
textView.setHintTextColor(getResources().getColor(R.color.text_color_hint));
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13);
3.对于改变光标颜色
还是使用主题色改变吧,把colorAccent改为自己光标的颜色即可
<item name="colorAccent">#27C084</item>